← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #201204]: Skip TestCase based on previous success/failure

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Since you seem to be relatively new to testing with Python's unittest,
but the right way would be to analyze the test test results produced by
the test runner - but this might be too complex for you at the moment.

So an easy way (similar to what Jacob said): just at the beginning of
your script define a global variable:

testOK = false

In your first test class at the places where you know it is a success, say
testOK = true

and then in the setUp() or even already in a setup/teardown of class 1
terminate your stuff or take corrective actions.

if not testOK:
    print "makes no sense any longer"; exit()

BTW: looking at your workflow description: seems not to be the typical
unittest showcase, so it might be a little bit too much effort with it.
Seems to be possible with a more normal straight forward script with a
main workflow and some def()'s.

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