HowTo: Twister & Sikuli

This is a short tutorial about how to run Sikuli test cases on Windows platform with Twister framework installed on Linux machine.

1. Install Oracle Java 1.7 on Windows machine

2. On Windows platform, install  ActivePython. You can download it from:
http://www.activestate.com/activepython

3. Download Sikuli-IDE from
https://launchpad.net/sikuli/+download
Extract the files from archive to a desired directory

4. Copy the Twister Windows EP into a local directory.
The Windows EP can be found in github client/executionprocess/ExecutionProcessWin.py
The following section can be found in ExecutionProcessWin.py:
userName   = ‘nisuser’
globEpName = ‘EP-sikuli’
# Central Engine IP and PORT ::
ce_ip_port = ‘11.126.32.9:8000’
SIKULI_PATH = ‘C:/SikuliIDE’
Edit the file ExecutionProcessWin.py to set the username, the name of the EP ( e.g. EP-sikuli ), the IP address/port of the CE and the Sikuli path set at step 4.

5. On Twister server machine, edit the file epname.ini for the user defined in ExecutionProcessWin.py.
Add the EP anme defined in ExecutionProcessWin.py.
Example:
[EP-sikuli] CE_IP   = 11.126.32.9
CE_PORT = 8000

That should be all for configuration.

Now you ca start writing your Sikuli testcases using the Sikuli IDE that can be launched with sikuli-ide.cmd file from your Sikuli path directory.
Using this IDE you can write your test cases. Examples and tutorials on how to write Sikuli test cases can be found at http://doc.sikuli.org/

After writing your test you have to save it. This will generate a directory having “.sikuli” extension ( e.g. twister.sikuli ).
From Sikuli IDE, export the executable sikuli test using File->Make zipped .skl
The name of the executable and the name of the directory where you previously saved your testcase must be the same. ( e.g. twister.skl ).
You must save the .skl file in the same directory where you previously saved your test case.
After that you must create an .zip archive that must contain the directory with your testcase and the .skl executable file.
The name of the archive must be the same as executable test case ( e.g.twister.zip ).

The .zip archive will be the testcase that you will have to execute in Twister.

To execute the Sikuli test cases, the following steps must be taken:
1. On Windows machine start the EP
python ExecutionProcessWin.py

2. Open the Twister GUI, using the user configured in ExecutionProcessWin.py

3. Create a suite of Sikuli test cases(.zip files) and select a test bed for it.

4. In Twister GUI, go in Configuration->Test Beds, select the test bed associated with the suite and check that it is
running on the EP defined in ExecutionProcessWin.py ( e.g. EP-sikuli ).

5. In Twister GUI, return to projects tab and press the Run button.

The execution should start and the recorded Sikuli test cases should be playback on the Windows machine.
The status of every test cases will updated in Twister GUI.

Happy testing !

Leave a Reply