Run all my tests back to back

Asked by Ali Ahmed on 2021-01-14

So I've create several tests. There are all in separate sikuli folders and I've scripted it so it's generating a html reportat the end of the tests. I wanted to know if there is a way to run them back to back? right now I'm just running them individually.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
Ali Ahmed (ali13xii) said : #2

Ok so would I do it like this:

exitValue = runScript("/SikuliX/Viewing and Edit Trade.sikuli")
if exitValue > 1:
   print "there was a special case"
elif exitValue == 1:
   print "there was an exception"
   print "ran with success"

exitValue = runScript("/SikuliX/LinkTagToTrade.sikuli")
if exitValue > 1:
   print "there was a special case"
elif exitValue == 1:
   print "there was an exception"
   print "ran with success"

its just printing "there was a special case", but only prints it once. How would I do it exactly, I would appreciate help on this.

Ali Ahmed (ali13xii) said : #3

I tried using this but its only running the first one once and it doesn't execute second test

runScript(r"C:\SikuliX\Viewing and Edit Trade.sikuli")


RaiMan (raimund-hocke) said : #4

This works for me:

unzip somewhere and adjust baseFolder in

in comment #2 the exit(exitValue) (line 8) in any case ends the main script.

BTW: Recommendation: Never use filenames containing blanks or special characters, only characters, numbers, hyphen and underscore. (Viewing and Edit Trade.sikuli is bad)

Ali Ahmed (ali13xii) said : #5

I tried that dropbox link but it didn't have any files in it. DO u have another link with code. I would like to see how u go it to work. I will make that adjustment to the sikuli folder names. I should just be able to rename the folder from windows explorer, that should be fine right?

RaiMan (raimund-hocke) said : #6

Sorry, cleaned my DropBox ;-)

Will try to recover it tomorrow.

Ali Ahmed (ali13xii) said : #7

Oh ok, I would really appreciate it.

Ali Ahmed (ali13xii) said : #9

So I tried to do it using your code as reference and it only runs the first test. Here is what I have:

baseFolder = "C:\SikuliX"
s1 = "LinkTagToTrade.sikuli"
s2 = "AddDocumentToTrade.sikuli"

exVal = runScript(os.path.join(baseFolder, s1))
print s1, exVal

exVal = runScript(os.path.join(baseFolder, s2))
print s2, exVal

Ali Ahmed (ali13xii) said : #10

Ok so I think its having issue because I'm using HtmlTest report for these tests. Here is code for LinkTagToTrade, would I need to change it to run it using Runscript?

import random
import shutil
import os

import utils

import HTMLTestRunner
import unittest

class UITestCases(unittest.TestCase):

    def setUp(self):

    def tearDown(self):


    def test_1(self):














        print("Final Count is {}".format(finalCount))




        #utils.selectTrade() First Trade should still be selected




        print("Actual Count is {}".format(actualCount))

        if finalCount==actualCount :
            print("Tag Linked: Test Pass")
            print("Number of Tags that should be Linked {} and actual Tags that are Linked {}".format(finalCount,actualCount))
            print("See captured images in Result images folder")
            assert True
            print("Tag not Linked: Test Fail")
            print("inital count is {} and actual count is {}".format(initialTags,actualCount))
            print("See captured images in Result images folder")
            assert False


suite = unittest.TestLoader().loadTestsFromTestCase(UITestCases)
outfile = open("Link_Tags_To_Trade_Results.html", "w")
runner = HTMLTestRunner.HTMLTestRunner(stream = outfile, title = 'Link Tags to Trade testreport', description = 'NEW').run(suite)

RaiMan (raimund-hocke) said : #11

--- description = 'NEW').run(suite)
does not look good ???

Try to close the outfile.

Ali Ahmed (ali13xii) said : #12

What do you mean by "close the outfile"
What adjustment would I need to make?

RaiMan (raimund-hocke) said : #13

Sorry to say: this is plain Python knowledge, which is essential when building more complex things with SikuliX scripts.

outfile = open("Link_Tags_To_Trade_Results.html", "w")

Can you help with this problem?

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

To post a message you must log in.