← Back to team overview

sikuli-driver team mailing list archive

[Question #194681]: Use String to call Function?

 

New question #194681 on Sikuli:
https://answers.launchpad.net/sikuli/+question/194681

Hello everybody!

I am very impressed by Sikuli so far, and now I would like to use it for a huge testing.
Therefore I have created multiple .sikuli-Files/Directories, one where I have Initialization-Stuff and then one .sikuli-File/Directory
per SubTest.
I have imported the other SubTests fine and can run them with no problem so far in the "Main"-Test-File.
But now I would like to optimize this further:
I would like to realize it that I only have to create a new SubTest (e.g. TestCase23.sikuli in a subdirectory of the "Main"-Test-Sikuli-Directory) and then edit the Main-Test-Sikuli-File and enter the Name of the new TestCase there into the "modulesToRun"-Variable.
The rest should work automatically (that the Main-File calls the new SubTest and runs the tests there).
E.g.:
In the Main-File:
---
modulesToRun = ("InitSystem","Test1", "TestCase23")

tempVar = modulesToRun # Create copy as the for-statement empties the variable
for f in tempVar:
    import f                               # Import all SubModules

.... # some other code
.... # some other code

tempVar = modulesToRun # Create copy as the for-statement empties the variable
for f in modulesToRun:
    f.RunMe()                           # Run all the tests per SubModule

--- 

How can I tell sikuli to treat "f" as an imported modulename for the "RunMe()"-call?

Then I would have a "RunMe()"-function in all SubModules and call all the Tests inside that module from there.

I hope I could explain a little bit, what I am trying to achieve ;-)

I would be greateful for any help!

Thanks a lot and best regards,

Chris

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.