Coded UI Tests

Hello,

I've created a solution with a test project.
In the test project there are several Coded UI Tests.
When I try to use Team City build configuration to run these tests automatically (using mstest agent), I get the following error:

Error calling Initialization method for test class <name>: 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)
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=165924)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize().

How can I configure my build to run those tests?

Thank you,
Uri.

1 comment
Comment actions Permalink

Hi Uri

By default build agents are installed as Windows services, and cannot perform UI automation tasks due to Windows security restrictions.
You'll need to run agents as processes within a user session by

buildAgent\bin\agent.bat start


During the build, desktop should not be locked, check that screen saver is disabled.
To make testing process reliable it makes sense to configure Windows machine to logon and launch the agent automatically.
Consider using a virtual machine for that.

Michael

0

Please sign in to leave a comment.