What's the best way to run multiple scripts in sequence

Asked by Aleksander

I'm new to the whole scene and read about different approaches over the lest 3 days.
Best one for me and for now looks like this:

dir = "the_path_to_main_directory"
scripts=["script1","script2","script3","script4",..]
scriptPath = os.path.join(dir, "script1"+".sikuli")
setBundlePath(scriptPath)
execfile(os.path.join(scriptPath, "script1"+".py"))
scriptPath = os.path.join(dir, "script2"+".sikuli")
setBundlePath(scriptPath)
execfile(os.path.join(scriptPath, "script2"+".py"))
scriptPath = os.path.join(dir, "script3"+".sikuli")
setBundlePath(scriptPath)
execfile(os.path.join(scriptPath, "script3"+".py"))
scriptPath = os.path.join(dir, "script4"+".sikuli")
setBundlePath(scriptPath)
execfile(os.path.join(scriptPath, "script4"+".py"))

Since there will be a lot of tests where I would have to put 15+ scripts together, it would take to much time to get those tests up and running.

So my question is, what would be the easiest way to run those scripts in a sequence?

I also tried import, but couldn't get it to work the way that's described already in :
https://answers.launchpad.net/sikuli/+question/267115.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I Suppose we are talking about pre final version 1.1.0 (http://sikulix.com):

if you want to stay with the concept "one-test-is-one-script", then you should have a look at:
http://sikulix-2014.readthedocs.org/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other

The other principal way is to use the unittest approach:
faq 1804 (HTMLTestRunner is bundled with 1.1.0 already)

Revision history for this message
Aleksander (ascernjavic) said :
#2

Sorry, I'm running the Sikuli 1.0.1.

The "one-test-is-one-script" I wouldn't use cause of the complex test cases I have to do. It would be easier to define test cases with predefined scripts.

Will check the faq 1804 and get familiar with it.

Can you help with this problem?

Provide an answer of your own, or ask Aleksander for more information if necessary.

To post a message you must log in.