For the past few days I have been cracking my head trying to figure out how I can run a Coded UI Test directly from a Jenkins Job. Since i am quite new to jenkins. I plan on running the jenkins job using the test controller and agent both installed in the same machine as the local VS project repository where my project is stored.
My goal is to get a Jenkins Job to run a coded ui test which interacts directly with my desktop.
Specification used for the test:
1. VS Enterprise 2015 2. Agents for MS 2013 3. Jenkins 1.69
What I have Done So far is Below (this is the batch command that i run from Jenkins, which i copied from How to run Coded UI test file from Visual Studio command prompt using batch file?) which works Successfully when run through CMD :
@echo off :: Running tests without VS Enterprise is possible if you install the Test Agent package: https://msdn.microsoft.com/en-us/library/dd648127.aspx set test_runner="C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDECommonExtensionsMicrosoftTestWindowvstest.console.exe" set test_dlls="C:LocationCompiledTestsProject.CodedUI.Test.dll" :: If tests is set then only these comma separate test cases are run :: set tests="Test1,Test2" set tests="" if %tests% == "" ( %test_runner% %test_dlls% > CodedUITestResults.txt ) else ( %test_runner% %test_dlls% /tests:%tests% ) pause
I am using my local repository (Not TFS or GIT since that is not the requirement) on my windows machine which is when running the script executes the coded ui test successfully.
However, when it comes to replicating the steps in jenkins I get this error (even after configuring the test controller using VS in a .settings file):/
Error calling Initialization method for test class CodedUITest: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see “How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop” (http://go.microsoft.com/fwlink/?LinkId=159018)/
My Questions are:
- Why does my tests keep giving me this error despite the fact that my
test agent has been set as interactive?
- Also, how would I get it to
run from Jenkins, in order for it to interact with desktop directly
as an interactive process?
Source: Stack Overflow