Popupwatcher does not pause the running testcase

Class library usage, coding and language questions.
mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Popupwatcher does not pause the running testcase

Post by mzperix » Wed Mar 12, 2014 2:26 pm

Hi,

We use popupwatcher with great ease, although we have a small problem with it. As the popupwatcher finds a clickable element, the main test keeps going on. This results in test failures, because the program tries to click on two elements at the same time (on the popup, and on the test element).

So what we need to do is to put some wait lines between the test steps where we expect the poups to be shown. This workaround only works when we know that after a step a popup could occur.

We use the WatchAndClick() method to achieve the popup handling.

Is there a way to handle this kind of behaviour, so we do not need to put the waits in our recordings?

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

Re: Popupwatcher does not pause the running testcase

Post by krstcs » Wed Mar 12, 2014 3:01 pm

The PopupWatcher runs in an independent thread from the main test, so there is currently no way for the PopupWatcher thread to pause the test.

The errors you are seeing are probably not from the PopupWatcher and Ranorex trying to do things at the same time (they don't and can't technically) but instead from timing issues.

If you expect the popup to be displayed, then you should not be using the PopupWatcher, as it is only intended for unexpected dialogs (like errors and exceptions).

I would suggest that you add a user code module in your test in the spot that you expect a popup. You can add logic in the user code that does what you want (clicking, pausing, etc.).
Shortcuts usually aren't...

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Popupwatcher does not pause the running testcase

Post by mzperix » Wed Mar 12, 2014 3:33 pm

I think I used the wrong term for the timing issues :) So looks like at expected places, I have to use user code.

So I rephrase my question:

If I have a popup dialog, that I know will come in the near future, but I don't know the exact time (for example, a popup message about a succesfull stock excange transaction, which would occur from the time it was opened until it's expiration date). How can I handle this type of situation?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Popupwatcher does not pause the running testcase

Post by Support Team » Thu Mar 13, 2014 3:06 pm

Hello mzperix,

In order to give an appropriate answer I need more information about the pop up, May I ask you to answer the following:
  • Is the pop-up window somehow important for your test case?
    Do you retrieve any information from it or do you just close it?
    Does the pop-up occur after a defined recording action?
    If yes, how long is the time span after this action in which the pop-up could occur?
Regards,
Robert
.
Image

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Popupwatcher does not pause the running testcase

Post by mzperix » Mon Mar 17, 2014 11:47 am

Hi Robert,
here are my questions in order:

The popup is not that important, but I cannot go on without closing the popup.
I don't want to retreive any information from it, just want to close it.
Well, unfortunately it occurs randomly. The program is a stock trade program. If I put a buy order on the market, a popup would occur when the order is successful. The problem is, that the poup occurence depends on the market (when someone will sell a share ont the price we set), so there is no way to determine when will the poup show up.

As suggested the post above by krstcs, the popupwatcher thread runs on an independant thread, than the main one, so I cannot pause the test. But can we alter a thread's priority in runtime? Would it work if we set the poupwatcher's thread priority to max, when the method watchandclick fires? And after finishing the method, set the priority to it's previous state?