1
votes

I want to run multiple (like 10 or so) sikuli scripts consecutively and output the result in XML. I have found this SO question:

How to generate report using sikuli for desktop application

and xmlrunner looks quite ok. Now, my sikuli scripts have multiple test methods, but not all of them have tearDown steps since those test don't do much.

  1. Do I have to implement all 3 methods for a test to work?
  2. How does the test runner work? Does it start by calling setUp and then proceeds to call all other methods in sequence?

Furthermore, using template provided in the answer of the question:

import xmlrunner
import unittest

class MyTest(unittest.TestCase):
    def setUp(self):
        // setUp

    def testMyTest(self):
        // test

    def tearDown(self):
        // tearDown

suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
result = XMLTestRunner(file("unittest.xml", "w")).run(suite)

How would I go and include all my sikuli scripts, which are all separate classes in separate folders? Is it possible somehow to reference or import the test .py file generated by sikuli? Reason is, I wouldn't like to copy and paste all code in one large file which would then have many classes and would be very large.

1

1 Answers

0
votes

You could make a Main() class where you call on all other files you would like to execute.
To call another file you could use execfile(), use the complete path to the .py file in the .sikuli directory.