While testing a GUI if the script does not see an image it wait fail and the script stops.

Asked by Jason

I am testing a GUI application and I want to log failures (images missing), but want the script to complete without stopping in the middle.

I am using the> assert exists(#link_to_image#), 5) When the script detects a missing image it will stop in the middle and log the error in the message field. I do not want to "SKIP" , the missing image in a "Not Found" situation and I do not want to "ABORT" or "RETRY" either. The purpose of my testing is to detect issues with the GUI not skip over them.

Is there another way to report the error at the end once the script is finished without stopping in the middle?

Question information

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

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.

Revision history for this message
Jason (jasonnaviello) said :
#2

Thanks RaiMan, that solved my question.