How to run tests remotely without display

Experiences, small talk, and other automation gossip.
ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

How to run tests remotely without display

Post by ElSticky » Fri Mar 14, 2014 2:10 pm

I'm looking for a way to run my tests without the need to have a display. So, my tests are on a server and I'm triggering the start of the tests by using Jenkins. I tried the plugins Xvnc and Xvfb in Jenkins to have a virtual screen but none of them seem to work as I want.

With Xvnc enabled I get black screens in my rxlog and when using Xvfb I got one test successfull but it is only one that is performed in the Chrome browser (web app). The others, which are in a Windows forms application, fail.

Any suggestions for this or is it impossible to have something like an 'invisible' screen?

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

Re: How to run tests remotely without display

Post by krstcs » Mon Mar 17, 2014 1:55 pm

It is not possible to use Ranorex without having a desktop available. It does not have to be visible to a user, but it must be unlocked and connected. Otherwise you will get black screenshots and failures to find objects. Also, locked screens on Windows mean that the mouse and keyboard are not available to Ranorex (only the Windows security subsystem has access to a locked screen so Ranorex wouldn't).

I use virtual machines for my test systems. I remote desktop into my server on an account that will not get logged out and then, from the server, remote desktop again into each of the virtual machines. I can then close (not logout) the remote desktop to the server and it will all still work.

Eventually we will be moving to a dedicated virtual machine host that will have a monitor and desktop that allows console/desktop access to the VMs so we don't have to daisy-chain the RDP sessions.
Shortcuts usually aren't...

ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

Re: How to run tests remotely without display

Post by ElSticky » Tue Mar 18, 2014 11:29 am

So what about the Xvnc and Xvbf tools? Can't they bring a solution to simulate a 'virtual desktop'?

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

Re: How to run tests remotely without display

Post by krstcs » Tue Mar 18, 2014 1:25 pm

In your case, from what you've said already, I would suggest that you run a Jenkins slave on the system you will be running your tests on. Jenkins should not be executing the Xvnc/RDP mechanic, it should only kick off the Ranorex test on the slave.

Xvnc/RDP/etc. would need to be running already so that you have a desktop already available for Ranorex to use.
Shortcuts usually aren't...

ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

Re: How to run tests remotely without display

Post by ElSticky » Fri Mar 21, 2014 12:03 pm

I think I've found a way to do this. So I'm running Jenkins by using the .jar file instead of the service and before executing my tests I open the RDP screen and in Jenkins I'm executing the command found on http://adamjarret.com/blog/2010/04/stop ... -the-host/ (get the idea by query user command) . It will close my RDP but the tests will start and continue. Also make sure your configuration is like the following site http://www.raymond.cc/blog/disable-remo ... n-on-idle/

So in short
Run jenkins by the jar
Open RDP connection
Execute your tests job with first command tscon.exe 0 /dest:console
RDP will show a message, click OK.
Test will run...

KapacRus
Posts: 30
Joined: Wed Apr 04, 2012 8:51 am
Location: Russia, Samara

Re: How to run tests remotely without display

Post by KapacRus » Tue Mar 25, 2014 11:05 am

Hi all!
For this purpose we use pool of virtual machines (windows 7/windows 8 ) with autologon, screen resize and teamcity in interactive process mode. RDP in CI sounds funny :D

axcha15
Certified Professional
Certified Professional
Posts: 4
Joined: Tue Sep 02, 2014 9:56 pm

Re: How to run tests remotely without display

Post by axcha15 » Tue Sep 02, 2014 10:03 pm

I was trying to run a test using a Jenkins master(linux) with a jenkins slave(windows server 2008) where my ranorex test was executed. I follow these steps and it work:

Created a file "CloseSession.bat" and save it on the desktop with these contents

%windir%\system32\tscon.exe <SessionId> /dest:console

You can get the sessionId value from the task manager in the users tab.

Then modify one of the following reg entries, in cmd type regedit

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client (for current user)

HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client(for every user)

Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.

Save the changes and before log out run the CloseSession.bat file as administrator, accept the privileges it will close the RDP session and then you can execute the Jenkins job and it will work.


The only issue that I have is that all the screenshots that the test have been taken have black screens but the test work as expected.