Run tests on automation machine remotely

Best practices, code snippets for common functionality, examples, and guidelines.
i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

Run tests on automation machine remotely

Post by i.vasilyev » Mon Jul 10, 2017 1:38 pm

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)?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Run tests on automation machine remotely

Post by krstcs » Mon Jul 10, 2017 8:22 pm

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.
Shortcuts usually aren't...

i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

Re: Run tests on automation machine remotely

Post by i.vasilyev » Tue Jul 11, 2017 3:14 pm

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?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Run tests on automation machine remotely

Post by krstcs » Tue Jul 11, 2017 4:09 pm

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
Shortcuts usually aren't...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Run tests on automation machine remotely

Post by Support Team » Wed Jul 12, 2017 9:05 pm

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
    image2016-8-11 12-8-9.png (142.81 KiB) Viewed 1991 times
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
.
Image