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).
Asked
Active
Viewed 2,314 times
0

donatelo
- 103
- 2
- 12
1 Answers
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
-
Thanks for your sugestion! But there is not python package sikul0i. Sikuli uses Jython – donatelo Apr 18 '14 at 15:43
-
please see this Post it can be helpful for you. http://stackoverflow.com/a/20366782/2091992 – justice Apr 28 '14 at 19:23