Page 1 of 1

PopupWatcher and Report.Failure

Posted: Thu Jan 23, 2014 3:32 pm
by odklizec
Hello,

I'm using PopupWatcher to handle some "unexpected" dialogs that could appear in our app. Once the dialog is detected a method is triggered, in which is taken a screenshot of the dialog, a message is logged about the appearance of the dialog and then the dialog is closed. So far so good.

The problem is that even though I use Report.Failure("message") to log the dialog, the test case/iteration is still marked as green/success...
success_failure.png
And the problem is that in report with hundreds of iterations, it's really hard to find the iteration with triggered PopupWatcher.

I guess my problem is related to the fact that PopupWatcher is run in a separate thread, am I right? I found several discussions on that subject but at that time, there was no known solution to overcome this problem.
Is there something I can do to mark the testcase/iteration failed? Thank you in advance!

Re: PopupWatcher and Report.Failure

Posted: Mon Jan 27, 2014 2:37 pm
by rprehm
Hi odklizec,

You are right. The popup watcher is handled in a separate thread. In order to mark the module as failed you need an additional recording action which lets the module fail.
Please have a look at:
Re: How to detect error icon coming from web application.

Regards,
Robert

Re: PopupWatcher and Report.Failure

Posted: Mon Jan 27, 2014 2:54 pm
by odklizec
Hi Robert,

Thanks for confirming my suspicion. I already implemented a workaround I used some time ago (before the PopupWatcher introduction). Basically, it's the same as your linked solution, but instead of "throw new Exception" I'm using "Validate.IsFalse(true,"description to report")", which means the test run is not interrupted, but the test/iteration is just set as Failed in Report. Exactly what I wanted ;)

Anyway, I think it would be nice to have the PopupWatcher extended with the possibility to stop the main thread or at least set the test/iteration as failed in report (without the need to hassle with the user code). Thank you!

Re: PopupWatcher and Report.Failure

Posted: Mon Jan 27, 2014 3:17 pm
by krstcs
I would have to agree with odklizec here.

It would be very nice if the PopupWatcher object could have a hook back to the calling test that would allow us to set the PopupWatcher to stop the test if we wanted.