Freigeben über


TFS build fails to trigger coded UI tests.

We have come across an issue where TFS build fails to trigger coded UI tests, based on how the Test Settings file is specified in the build definition.

The failure message returned is as below:

Error calling Initialization method for test class <projectname>.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" (https://go.microsoft.com/fwlink/?LinkId=255012)

Setup / Environment Details

· TFS server, build and test controllers and agents, Visual Studio, all running 2013 update 4.

· The test controller to be used while executing tests during TFS build is specified using a test settings file.

· Test agent is configured to run interactively in order to run coded UI tests.

Repro Steps for the issue

· Open a build definition (Default Template) which doesn’t have Testsettings file already specified. Select your project to be built, which includes a coded UI test to be executed as part of it. Specify this information under the ‘projects to be built’ section.

· Navigate to the Run Settings section in the Automated Tests section under Test node.

1

· Click on Run settings file ellipses button and specify the Test Settings file, which contains the test controller information, where the coded UI test has to be run.

· Change the value of Type of run settings from Default to UserSpecified, in the drop down.

· Now queue a build, the tests would fail to execute, with the below error message:

2

This time around the build doesn’t even try to connect to the test controller machine, because we observe the same error message even if we specify a random machine name for test controller in the test settings file.

Workaround

· Open build definition, click on the ellipses button against the TestSource field within Automated Tests under the Test node.

3

· Click on Edit, choose Custom under Options, and then Browse and select the TestSettings file, click OK.

4

· The Run settings section is also automatically updated with the corresponding values.

5

· Queue a build, and the tests execute successfully as part of the build.

We have confirmed that the issue happens with the Default Template in TFS 2015 as well. Please continue to use the work around while we investigate more in this issue.

Thanks!

Content created by – Sreeraj Rajendran
Content Reviewed by – Romit Gulati