简体   繁体   中英

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?

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

In my case, I wanted to have the same thing. I wanted to run several tests and create a report. What I did was created a simple application which ran the selected sikuli scripts one by one on the command line. I collected their output (pass, fail, error messages) in a text file and displayed it again in the app. One can actually write an Html or something.

eg runsikulix.cmd -r TableSelectCells.sikuli >> report.txt

Here you can check more how to do it from the command line. http://doc.sikuli.org/faq/010-command-line.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM