Question #270543 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/270543
Eugene Maslov proposed the following answer:
Hi Sahil,
I run data driven tests with python unittest.
It's possible to modify __init__ procedure of the test template, that all the
tests are derived from, in a way to accept parameters, and then write a hub
python script which adds the test cases to the test suite with these
parameters, including calling same test cases with different data sets if you
want.
Something like that.
=====
test template sample:
class testbase(unittest.TestCase):
def __init__(self,*args):
self.testname=args[0]
super(testbase, self).__init__(self.testname)
#get parameters of the current run, coming from start.py script:
self.cleansettings=args[1]
self.start=args[2]
self.kill=args[3]
self.apptype=args[4]
def setUp(self):
pass
def tearDown(self):
pass
=====
test case sample:
class myapp_001(testbase.testbase):
def test_001(self):
if self.start=="start":
SCREEN.click()
=====
The following lines add tests to test suite in the hub start.py script
('clean','start', etc. are options of the test execution, which may
contain necessary data that you want):
thesuite=unittest.TestSuite()
thesuite.addTest(myapp_001("test_001",'clean','start','nokill','wide'))
thesuite.addTest(myapp_001("test_001",'noclean','start','kill','narrow'))
fp=file('c:/temp/result.html','wb')
runner=HTMLTestRunner.HTMLTestRunner(stream=fp,title=' My auto
tests',description='My auto tests')
runner.run(thesuite)
fp.close()
=====
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.
_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help : https://help.launchpad.net/ListHelp