2
votes

When I'm trying to run Coded UI Test (Orderedtest1.orderedtest) from VSTS, I'm getting the following error at VsTest step:

***Error Message:
Error calling Initialization method for test class 
CodedUITestProject1.CodedUITest1: 
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=255012)
If you are running the tests as part of your team build, you must also set 
up the build agent to run as an interactive process. For more information, 
see "How to: Configure and Run Scheduled Tests After Building Your 
Application" (http://go.microsoft.com/fwlink/?LinkId=254735)
Stack Trace:
at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.Before
TestInitialize(Object sender, BeforeTestInitializeEventArgs e)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
Skipped  2- CodedUITestMethodB (OrderedTest1)***

OS (Test Machine): Windows 10 Pro (64-bit OS, x64-based processor) VS: Visual Studio Enterprise 2015 with Update 3

Build Definition details are shown below:

enter image description here ![enter image description here]2 enter image description here

Did I miss any steps above? Please help me resolving the build failure problem.

1
Are you using the hosted agent or a private agent? - Daniel Mann
It's a private agent. - Ayan
Is it configured to run interactively? - Daniel Mann

1 Answers

2
votes

You are using Visual Studio Test task, that uses build/release agent to run test, so you need to configure the build/release as interactive mode in order to run Coded UI test, so reconfigure it as interactive mode.

enter image description here

Note: If the agent stopped, you can call run.cmd in Command Prompt (run Command Prompt as administrator), you can’t close this window otherwise the agent will be stopped.