Running Coded UI test remotely

Manish picture Manish · Apr 17, 2012 · Viewed 10.8k times · Source

I have to run Coded UI test remotely on a VM. I am using Mstest.exe to execute the test cases. Now when i run it , through Windows scheduler , it fails because it need "Active Desktop ".

I read it a few places that we need to use test agent. But i dont want to configure test agent and test controller just to set "Active desktop", Is their something else that i can do ?

Answer

Stas Sh picture Stas Sh · May 22, 2012

Well there is no hard in setting up a test controler and a test agent, it is really easy and its the best way to go. You can find the installation guidelines here: http://msdn.microsoft.com/en-us/library/dd293551.aspx

However, there are few issues that still exist even when you use a controller.

The Test Agent can run in either Service or Process mode. For coded ui test you need to run it in a process mode (because it needs to be in the same windows session). But when you log into VM, with Remote Desktop, and close it, the Desktop of the target machine stays locked and tests cannot proceed. And unless you log in, there is no active session and test controler doesnt even get started.

There are 2 ways to keep an active desktop that i know of:

  1. (recommended) Run AutoLogOn.exe from sysinternals suite (can be found at http://live.sysinternals.com/). It will automatically log in with specified user than the machine starts, and keep the desktop active.
  2. Keep a remote desktop in a non minimized window active. There are few applications that you can find that can keep multiple remote desktop's open, and keeping it connected should do the trick.

Stas.