Search code examples
pythonjythonsikuli

Run Sikuli files from another sikuli project


What I want to do is to have several UnitTests written in sikuli, in different files, and then generate a report.

I would want to do something like this:

Project Tests_Thing1.sikuli:

import unittest

class Tests_Thing1(unittest.TestCase):
    def setUp(self):
        #do some stuff     
    def tearDown(self):
        #do some stuff  
    def test_Created(self):
        #do some sikuli stuff  

And there are similar Similar Tests_Thing2 and Tests_Thing3 projects

Project Run_Tests.sikuli:

import unittest
## import siluli projects?

suite = unittest.TestSuite()
suite.addTests(Tests_Thing1)
suite.addTests(Tests_Thing2)
suite.addTests(Tests_Thing3)

suite.run(result)
#generate report from all tests

Is there a way to do this?


Solution

  • I think you can use the standard unittest http://www.jython.org/jythonbook/en/1.0/TestingIntegration.html and import Sikuli into your classes. You need Jython to run it as the following

    How to import the sikuli module in python?

    https://answers.launchpad.net/sikuli/+question/136170