Introduction
This page describes how to run UI tests from Jenkins on Windows VM using Jenkins Slave.
There are two options, depending on the Windows version.
On older Windows systems like XP
- Run Jenkins Slave as a service
- Go to "Computer Management" -> "Services" -> "Jenkins Slave", select "Log On" tab and select "Allow service to interact with the desktop"
On newer systems like Windows 7 and Windows 8
There is an additional service for "Interactive Services Detection" which requires manual user interaction ...
As a workaround we have to start the Jenkins Slave in a user session (not as a service) and then if we have to disconnect from the target VM machine we have to keep the current session opened, using a simple command "%windir%\System32\tscon.exe "RDP-Tcp#0" /dest:console" that will log you off and return the system to it's console.
Run Jenkins Slave command line (headless):
java -jar slave.jar -jnlpUrl http://<JENKINS_SERVER>/computer/<SLAVE_NAME>/slave-agent.jnlp
If you want to start it automatically, you can create a .bat file and link it in the "Startup" folder or create a Windows Scheduled Task but set its startup when a user is logged on only.
Disconnect from the VM using "tscon" command:
tscon RDP-Tcp#0 /dest:console
The name of the session depends on the current name in Task Manager. Instead of name you may also use the ID (plain number).
- the screen resolution would be the system default one (usually 640x480 or 800x600), so if you want to use another resolution, you should use some utility for screen resize.
For 32-bit Windows you can use QRes.exe - a small (open source) freeware application.
disconnect.battscon RDP-Tcp#0 /dest:console timeout 5 C:\QRes.exe /x:1920 /y:1080
For 64-bit systems you may use nircmd utility from NirSoft
Its parameters are width, height and bits-per-pixel (color depth)Example:
disconnect.battscon 2 /dest:console timeout 5 C:\bin\nircmd.exe 1650 1080 24
If you find it not working, check the user session that you are using on the RDP. Open Task Manager and then the Users tab. Then check the Session column. The session number corresponds to the number in the command - RDP-Tcp#0. Instead of session name you may use the number from the ID column.
Back to parent page
Go to Table of Contents