Remote GUI Test Automation on Windows

When you write automation tests, in many cases you can’t test your application from your development machine. The common reasons for that are:

  • Network limitations – the machine is not connected to the actual setup
  • CPU limitations – the machine is not strong enough to handle the tasks
  • HW limitations – the machine doesn’t have required interfaces (ports, connectors, etc)
  • SW limitations – usually licenses to expensive software
  • Resources limitations – one setup is connected to number of test machines

Let’s look at the case that the test machine is connect directly to the project and all the test should run from that machine. If you are working in windows environment probably you will use RDP from your computer to the remote machine. The problem is that everything will work as long as you are logged in, when you close the RDP session the GUI session will be lost. Once the session is closed, all automation testing tools will not be able to recognize the application under test. In addition when you close the remote session the client is disconnected from the desktop session and the remote machine will remain locked.

 Here is a solution to this problem:

  • Connect to the remote machine via RDP.
  • Run the automation tests
  • When you want to close the RDP use this command: “tscon YourSessionIDNumber /dest:console“. This command will close the RDP but the session will remain active. 

Note that you will need to do the same thing on every restart of the machine, so the best solution would be creating a simple batch that will run listed above steps on startup.