← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #270599]: While testing a GUI if the script does not see an image it wait fail and the script stops.

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
for this one usually use something like unittest and pack each image test in an extra testcase.
each testcase then ends with an assert and the assert results (pass/fail) are reported in the test report.

with your usage of assert it simply stops if an assertion fails with an
assertion exception (which is the intention of this feature).

But assert simply is nothing else than a shortcut for something like
this (meta code):

if  not exists(#link_to_image#), 5):
    throw an assertion exception
else:
    do nothing and proceed

So if you do not want to use unittest (see faq 1804), then you have to
replace the asserts by something like this:

if  not exists(#link_to_image#), 5):
    print "NotFound: ", #link_to_image#

so in case of not found you get the message and in any case the script
continues.

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