Using Sikuli with BDD (Behave or Lettuce)

Asked by Adrian Pothuaud on 2018-02-19


I am an active user of Sikuli !

I use sikuli with python language and I use to run my scripts by calling java -jar sikulix.jar myscript.sikuli

I would like to know if there is a way to use BDD with my Sikuli test scripts instead of unittest.

My script are looking like this:

--- script sample -------------------------------------------------------------------------------------------------

# -*- coding:utf-8 -*-

ok 2/19/2018 - Windows

import unittest
import os
import datetime
import HTMLTestRunner
import testscontext
import applications

class ApplicationsTestCase(unittest.TestCase):

    def setUp(self):
        App.close('Google Chrome')

    def testLaunchChromeWithoutWaiting(self):
        applications.launch_app("google chrome", wait_img=False, timeout=10)

    def testLaunchChromeAndWait(self):
        applications.launch_app("google chrome", wait_img=True, timeout=10)

if __name__ == '__main__':

    tests = unittest.TestLoader().loadTestsFromTestCase(ApplicationsTestCase)
    now =
    filename = "{}-{}-{}.{}h{}.html".format(
        now.year, now.month,, now.hour, now.minute
    with open(os.path.join(testscontext.outpath, 'test_reports', 'applications_tests', filename), 'w') as rf:
        runner = HTMLTestRunner.HTMLTestRunner(
            stream = rf, description="Unit testing src/applications. Environment: {}.".format(Env.getOS()),
            title="Applications", dirTestScreenshots=os.path.join(testscontext.outpath, 'test_reports', 'applications_tests')

--- end script --------------------------------------------------------------------------------------------------------

Then can I write something like that instead ?

--- script sample -------------------------------------
Feature: Test Applications launching

  Scenario: Launch Google Chrome

    When I launch "Google Chrome"
    Then I shoud see "google chrome menu icon"

With steps definitions in another .sikuli/.py module of course.

So the main question is: is sikuli behavior compatible with BDD testing and Jerkhin language ?
If yes how to implement Behave/Lettuce BDD tests ?


Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

sorry for the late answer.

Nothing special with SikuliX if you are scripting in Python.

Just setup a Python based Behave environment and do what is needed.

JetBrains PyCharm for example has builtin Behave support.

Can you help with this problem?

Provide an answer of your own, or ask Adrian Pothuaud for more information if necessary.

To post a message you must log in.