0

I'm new in sikuli. I would like to add to my python (version 2.7) unit test (in fact selenium webdriver tests) sikuli features (be able to check if particular image is displayed on webpage). Any suggestion how to do it? I tried to install https://github.com/kevlened/sikuli_cpython but I'm getting errors (as it probably requires Cython).

donatelo
  • 103
  • 2
  • 12

1 Answers1

0

check out the unnittest tutorial here. in any method of your test you can write sikuli/selenium code. here ist an example.


    import unittest, os
    from xmlrunner import *
    from sikuli import *

    # unittest class
    class Test_thing1(unittest.TestCase):

       def setUp(self):
        """do initialisation here may be sikuli code"""

       def testfunction1(self):
        val=exists('windows_start_Btn.png')#this is sikuli
        self.assertFalse(val, msg="your are not on Windows")

      def tearDown(self):
        """ do this at the end of the test may be sikuli code"""

    if __name__ == '__main__':
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_Thing1) #give the class name

    result = XMLTestRunner(file("unittest.xml", "w")).run(suite)
    print result.errors
    outFile.close()
    
justice
  • 306
  • 2
  • 12