← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #677438]: Pass argument to test runner

 

Question #677438 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/677438

Rares Pasca posted a new comment:
I'm halfway trough.

I give the following arguments in cmd:

java -jar pathToSikuli -r pathToTestRunner --args MyClass.startApp()
MyMethodLocation.createProject()

The class that contains the tests looks like this:

class TestSuites(unittest.TestCase):

    def firstTest(self,aList):
        #steps returned by argumentsCollector()

def argumentsCollector():
    argumentsList = list()
    for i in sys.argv:
        argumentsList.append(i)
    argumentsList.pop(0)
    HagercadLogger.Logger.Log(HagercadLogger.LEVEL_WARNING, "PRINT: " + ', '.join(argumentsList))
    return argumentsList   

def hagerTests():
    suite = unittest.TestSuite()
    suite.addTest(TestSuites('firstTest'))
    return suite

argumentsCollector() return a list that looks like this [MyClass.startApp(),MyMethodLocation.createProject()]
hagerTest() - is a suite that contains one test, the test inside my unittest class.

Is there a restriction to unittest in it;s default implementation, or i
can pass arguments to e method inside a unittest class, like in my
method firstTest(self,aList) , where aList would be the list of
arguments(action/steps) collected from cmd? And then this method knows
that the list is actually some steps in a test.

I'm noob in python unfortunately.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.