To be able to use the full power of Sikuli based test cases they have to work in the ‘bigger’ picture, running countinuosly in a Jenking master/slave setup. This post will go through the steps we needed to take to get Jenkins slaves (running Windows 7) to execute Sikuli based tests reliably in a larger Jenkins setup.
- Creating the local user
- Disabling screen savers
- Disabling screen lock
- Hooking up the slave to the master
Basic requirements for a Sikuli test execution slave
To be able to use a Windows 7 based Jenkins slave for running Sikuli based tests there are a few things that needs to be understood first.
As soon as the the current user on a machine gets logged out or gets its screen locked any Sikuli based tests will stop working. Secondly to be able to run tests triggered through Jenkins the executing user (the user that runs the Jenkins process) needs to have access to the desktop to be able to run applications like browsers in a visible way. Running Jenkins as a web service in Windows 7 will prohibit visible execution of applications or in other words the service is not allowed to access the desktop. Meaning that things are not as simple as starting Jenkins as a Windows service and then hook it up to the Jenkins master. Java web start (JNLP) is the way to go.
Requirements in short …
- local user that is always logged on
- machine that never gets locked
- node that connects to the Jenkins master using Java web start (JNLP)
- Java and environment variables configured properly to run Sikuli-based test cases (here)
Getting the local user in place
1) Create a local superuser account on the slave node.
2) Set the following keys in the registry to ensure that the user never gets logged out.
Open the registry editor (regedit) and add a new DWORD as named DisableLockWorkstation and give it the value 1 (1 = disable) to the path below.
3) It also has to be made sure that the local user always gets logged on automatically if the physical machine gets restarted. Open the following entry in the registry editor.
Make sure the following keys are present and that they are set accordingly.
AutoAdminLogon Value : 1
DefaultPassword Value : 'the password set for the created local super user'
DefaultUsername Value : 'the super user name'
Reboot to try it out.
Disabling all screen savers
One again using the registry, set the ScreenSaveActive key to 0 in the location below.
Connecting to Jenkins master
1) On the test execution slave, open any browser that has java support
2) Navigate to the URL of the Jenkins master
3) Manage Jenkins -> Manage Nodes
4) Add a new node
5) Select the new node and click on the Launch button to connect to the master using JNLP, if the node already has all the correct Java installations and environment variables we are set to go (here).
Firewalls, getting the JNLP connection to work might need changes in firewalls. Jenkins is by default configured to use a randomly generated port for the JNLP connection. Change this setting to use a fixed port number then there should not be to big of a trouble getting the firewall rules in place.
Manage Jenkins -> Configure System