Is it possible to run Coded UI tests without having to connect via remote desktop?

Ciaran Gallagher picture Ciaran Gallagher · Jul 31, 2012 · Viewed 15.7k times · Source

I'm attempting to automate Coded UI tests.

My test controller launches the tests on a remote test server, which I normally access via a Remote Desktop connection.

Is it possible to run the Coded UI tests without having to connect via remote desktop?

Currently, the tests only run when I have connected via Remote Desktop, and the window must be open. When I close the Remote Desktop session, the tests do not run.

If it isn't possible to run coded UI tests without remote desktop, how can I automate connecting via remote desktop?

Thanks

Answer

mjohnsonengr picture mjohnsonengr · Aug 1, 2012

I ran into the same issue with our remote test machine, but our test machines run on Hyper-V. With Hyper-V, the solution is simply to connect via Hyper-V instead of Remote Desktop Connection, and closing the Hyper-V connection won't lock the computer.

Another suggestion would be to get around the fact that Remote Desktop automatically locks your screen. There's a quick bit about that here: http://homeservershow.com/remote-desktop-session-locks-workstation-after-exit.html

Basically, run "tscon.exe RDP-Tcp#0 /dest:console" in command prompt from the remote machine when you want to disconnect. The machine should remain unlocked and the tests will run just fine.

According to @Zatricion, that command can be generalized:

tscon.exe %sessionname% /dest:console