I am using python, unittest and sikuli to create and run some automated tests. So here is my code:
class TestSmoke(unittest.TestCase):
def createdTestFromArgument(self):
#step1
#step2
#step3
...
#stepx
def argumentsCollector():
argumentsList = list()
for i in sys.argv:
argumentsList.append(i)
argumentsList.pop(0)
return argumentsList
def testBuilder():
#requested help
def smokeTests():
suite = unittest.TestSuite()
suite.addTest(TestSmoke('createdTestFromArgument'))
return suite
I have a test inside TestSmoke class and a suite, smokeTests(). This is like the standard unittest.py approach.
I am running the script like this:
..pathToProject --args step1 step2 step3
argumentsCollector()
takes the arguments from command line and adds them to a list then returns the list. So far so good.
Inside the testBuilder()
, I want to create a method like the one inside TestSmoke class with the test steps that are given in cmd and collected in my list inside argumentsCollector.
Then if I'm able to do this to call it inside createdTestFromArgument or inside TestSmoke class in order to run it like unittest.py test.