PopupWatcher and Report.Failure

Ask general questions here.
User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

PopupWatcher and Report.Failure

Post by odklizec » Thu Jan 23, 2014 3:32 pm

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!
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

rprehm

Re: PopupWatcher and Report.Failure

Post by rprehm » Mon Jan 27, 2014 2:37 pm

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: PopupWatcher and Report.Failure

Post by odklizec » Mon Jan 27, 2014 2:54 pm

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!
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: PopupWatcher and Report.Failure

Post by krstcs » Mon Jan 27, 2014 3:17 pm

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.
Shortcuts usually aren't...