Page 1 of 1

Run tests on automation machine remotely

Posted: Mon Jul 10, 2017 1:38 pm
by i.vasilyev
Hello.
AUT: desktop app
I have an automation machine(win server 12) with installed Ranorex and I want to execute automated tests in that machine. The problem is: I always should keep alive RDP session with the automation machine, otherwise tests will be marked as failed. How can I solved this problem? Can somebody provide the solutions for question how to execute tests using Ranorex on server via CI(Jenkins for example)?

Re: Run tests on automation machine remotely

Posted: Mon Jul 10, 2017 8:22 pm
by krstcs
Your remote system MUST have a FULLY REALIZED AND UNLOCKED DESKTOP in order for Ranorex (or any other UI test system) to function properly. There is no getting around this as it is a WINDOWS security feature.

That means you will either need to keep RDP open, or use something like VNC.

Re: Run tests on automation machine remotely

Posted: Tue Jul 11, 2017 3:14 pm
by i.vasilyev
Ok, got it. But maybe somebody can provide an example of best practice? How to use Win Server for automation and how to get FULLY REALIZED AND UNLOCKED DESKTOP for a server?

Re: Run tests on automation machine remotely

Posted: Tue Jul 11, 2017 4:09 pm
by krstcs
My recommendation is to stop using a server for UI testing. A server is not intended to be used as a desktop and testing on it can have other issues since the security features are more strict.

You should be using a desktop operating system for testing desktop or browser-based apps as that is how your customers will generally be using your applications.

But that's just my opinion, so take it for what it cost you... :D

Re: Run tests on automation machine remotely

Posted: Wed Jul 12, 2017 9:05 pm
by Support Team
To automate on a remote machine, I recommend using a Ranorex Remote Agent. Regarding keeping the user session active, there are a few different methods.

Solution #1 Solution #2
  • Create a batch file on your remote machine and insert the code below:
    Save this batch file on the desktop of your remote machine and name it ‘KeepSessionOpen.bat’. If you need to disconnect the remote session, you can now simply run this batch file using administrator rights and your remote machine will remain unlocked.

    KeepSessionOpen.bat

    Code: Select all

    for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
      %windir%\System32\tscon.exe %%s /dest:console
    )
Solution #3
  • Use one remote machine as a central hub to all your other remote machines. This central hub will always keep the remote sessions opened. When you need to connect to one of your remote machines, connect to this central hub instead. When you disconnect, you will end the active user session to the central hub, but it will keep the session’s active on all other remote machines.
    image2016-8-11 12-8-9.png
Solution #4
  • Create a new registry entry on the host machine to prevent locking the remote desktop connection
    1. Close all Remote Desktop connections
    2. Open the registry editor (Start > Run > “regedit”)
    3. Find the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
    4. Create a new DWORD named RemoteDesktop_SuppressWhenMinimized and set that value to 2
    5. Find the registry key HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Terminal Server Client
    6. Create a new DWORD named RemoteDesktop_SuppressWhenMinimized and set that value to 2
I hope this helps!

Cheers,
Ned