Determine if AUT is busy/blocked?

Best practices, code snippets for common functionality, examples, and guidelines.
slither
Posts: 11
Joined: Thu Jun 18, 2009 3:27 pm

Determine if AUT is busy/blocked?

Post by slither » Fri Jul 15, 2011 11:25 pm

How do you guys determine when the AUT is doing heavy processing/busy/blocked?

I'm dealing with an app that spends a lot of time waiting for the DB to respond. When the app is waiting for the DB results, the app itself is idle (doesn't register any CPU usage), but it's blocked (you can't click or interact with it).

-So far, I've tried looking at the mouse pointer (hourglass) as an indicator, but sometimes the app is blocked but cursor is normal.

-I've tried looking at the parent process of the AUT for TotalProcessorTime (this measures if the app is IDLE or BUSY), but like I said, sometimes the app is IDLE, and still blocked.

So i'd like to tape into the Ranorex crowd's experience to see how you guys handle that?

Thanks

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Determine if AUT is busy/blocked?

Post by Ciege » Sat Jul 16, 2011 12:26 am

Does your AUT present any sort of indication to the end user that it is busy? IF not, I would consider that a design flaw, but thats OT.
A please wait text, or grayed out buttons, etc...

You should have Rranorex watch for something that only appears during the busy period or watch something (like a button or text box) to become enabled again. You can do this using a simple while loop. I.e. while thisbutton is not enabled, sleep for 1 second.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

slither
Posts: 11
Joined: Thu Jun 18, 2009 3:27 pm

Re: Determine if AUT is busy/blocked?

Post by slither » Sat Jul 16, 2011 12:57 am

@Ciege: No visible indication whatsoever. It is a design flaw, but I don't have access to the code for fixing, so I'm looking for ways around that. It'll most likely have to be a Win32API call...

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

Re: Determine if AUT is busy/blocked?

Post by Support Team » Sat Jul 16, 2011 2:57 pm

Ciege wrote:You should have Ranorex watch for something that only appears during the busy period or watch something (like a button or text box) to become enabled again.
The way Ciege proposed is the recommended one by Ranorex. As he said, just search for something that becomes enabled (e.g. using the "enabled" attribute in your RanoreXPath) or appears when the AUT is ready again. You don't even need a loop, you can just use a repository item with a higher timeout.

Alternatively, if your application does not provide a visual effect when it is unresponsive, you can try to use the NativeWindow.AppHung property that is "true" when the form is not responsive to window messages. You can again wait for the "AppHung" property to become "false" in a loop or you add that condition (@apphung='false') to your RanoreXPath:
Ranorex.Form form = Host.Local.FindSingle(
    "/form[@title='Your App Title' and @apphung='false']", 60000);
Regards,
Alex
Ranorex Team
.
Image