← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #173986]: Is there a way to have the Messages window from Sikuli after a test pass has finished to be written to a file

 

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

Harry Readinger proposed the following answer:
My system uses the following structure (for reference, you dont have to
use this structure):

Master Script:
  -Does the Actual Logging
  -Does not do the error checking itself
  -sets up the logger
  -Executes Test Scripts

Test Scripts
  -Do the action
  -Keep track of errors/return those errors to the master script via global list

here is the master script itself:
http://pastebin.com/4GNdsKLe

The error handling part of the test scripts (its the same scross all
scripts):

global events 
events = []

theTests = [name, of, all, functions, in, the, script]
for test in theTests:
    try:
        test()
        events.append([1, test.__name__, " OK"])
    except:
        error = str(sys.exc_info()[1])
        entry = theTests.index(test)
        events.append([2, test.__name__, "\n\t" + error])
        print events[entry][2]

Any time there is an error on a part of the script (I have my whole
script broken down into functions that preform one very specific
action), an exception is raised, then the function name and exception
are appended to events.

If you have any further questions (or dont get something or whatever)
ask away

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