The first important thing to know is that Ranorex, as every other automation software, is not able to automate via the Remote Desktop window. It is not possible to recognize any controls since the content of the remote desktop is only provided as one big image.
The only way to automate using the Remote Desktop window to work coordinate based or with image comparison. This is not recommended by Ranorex because minimal variances in your system will make your tests fail.
To guarantee successfully testing on remote machines, you have to install and start all Ranorex Tools you need on the remotely connected machine.
Remote Desktop locks the screen when you minimize or close the Remote Desktop window. That causes screenshots to be blank/black and automation to fail. Consequently, if you use Remote Desktop, you need to have the RDP window open during automation and not closed or minimized.
Also make sure that the screensaver is not activated on your remotely connected machine as the screensaver will also lock the Remote Desktop's screen.
As a workaround, you can set up one machine having all of your Remote Desktop windows opened. This machine does not do any automation. And while your tests are running on the different Remote Desktops – with the client windows opened on the mentioned machine – you can lock the desktop on this machine. While your client desktop is locked, the Remote Desktop sessions will remain opened and your test will continue.
An alternative to RDP is using VNC or the VMWare Remote Console as these tools will not lock the screen when closing or minimizing the remote client window.
As an alternative to locking the screen on your Remote Desktop, you can disable the physical mouse and keyboard on the remote machine. To do that just set the Ranorex Keyboard.Enabled and Mouse.Enabled properties to false. Be careful if you disable both keyboard and mouse because both devices will stay disabled until you set the Enabled property back to true or the automation process ends!
If you want to disable the input for the whole test cycle, you should set
Keyboard.Enabled = false;
Mouse.Enabled = false;
in the Program.cs file.
But again be careful when using these properties because when you set both to false you cannot abort the test without an AbortKey set.
So also set
Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
in Program.cs to abort the test if something unexpected (e.g. an endless loop) happens.
You can also use this technique for one recording only. In this case you have to enable/disable the mouse and keyboard controls in user code directly before executing specific actions. As always, don't forget to enable controls again at the end of your recording and to set an AbortKey.
If you perform image based automation/validation on remote machines, you have to make sure that color and resolution settings are the same as on the machine you made the test/recording on.
Please also make sure that you have activated the same windows scheme since your application under test might be displayed differently when having different schemes activated.
Download Test Automation Guide
(PDF file, 20MB)