How to identify application state if application is hung?

Ask general questions here.
cancerion
Posts: 30
Joined: Tue Jun 16, 2009 6:15 pm

How to identify application state if application is hung?

Post by cancerion » Thu Aug 06, 2009 12:51 pm

I am using Ranorex 2.1.2 version to test Microsoft Outlook 2K3/2K7.During testing sometimes Outlook got hung or crashed.
Can anyone tell me how to identify the state of application when it is hung or crashed?

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to identify application state if application is hung?

Post by Support Team » Thu Aug 06, 2009 4:56 pm

You might want to try the NativeWindow adapter (from your Form) which contains a property named
"AppHung"

Michael
Ranorex Team

balajichandan
Posts: 24
Joined: Tue Apr 14, 2009 12:29 pm

Re: How to identify application state if application is hung?

Post by balajichandan » Thu Sep 17, 2009 9:09 am

When hang is observed, we will be not able to run our application (which is using Ranorex). Unless we get the form, we cannot query for property "AppHung". Then it becomes chicken and egg problem.

Moreover, if I have more than 1 application launched from my application, how to identify which application has hung.

Should I use background process to identify the hang? Any clue on this?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to identify application state if application is hung?

Post by Support Team » Thu Sep 17, 2009 12:37 pm

Could you please describe in more detail what you are trying to accomplish and what is running where (including Ranorex).

Regards,
Michael
Ranorex Team

balajichandan
Posts: 24
Joined: Tue Apr 14, 2009 12:29 pm

Re: How to identify application state if application is hung?

Post by balajichandan » Thu Sep 17, 2009 1:14 pm

We are developing Ranorex Automation Suite with Ranorex 2.1.3. Our application is integrated with Outlook. We automate scenarios using Outlook controls and windows. We have crash handling framework integrated with our Ranorex Automation Suite. The objective of this is to identify if any crashes are found, handle them and continue with next case.
We use Windows Debugging Tools to handle crashes. As part of this, we will get 'cdb.exe' console window application with cdb.exe as part of window text. We use the same text to identify this console window and close it and then continue with next test case.
Whenever we observe this cdb.exe during our Automation Suite run my Outlook and other applications become hung. I could see it from my Task Manager->Applications tab with status as 'not responding'. I want to know how to identify my Outlook application is hung. But I could see cdb.exe window is active and I could spy it with RanorexSpy. I could see 'AppHung' property of cdb.exe in RanorexSpy as 'False'. To verify 'AppHung' property, first I should be able to query Outlook form. Then only i can use 'AppHung' property to know if it is hung.

Moreover Ranorex is not able identify cdb.exe console window. We tried following ways to identify the same window:
Using Object repository
using RxPath
Enumerating all forms using Host.Local.FindChildren()

But none of them is able to identify this window.

I hope I have answered your question.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to identify application state if application is hung?

Post by Support Team » Thu Sep 17, 2009 2:06 pm

It might work if you collect all Outlook forms *before* starting your test cases :
myAutForms = Host.Local.Find("/form[@processname='OUTLOOK']")
and then check if they are hung:
foreach(Form form in myAutForms)
  if (form.As<NativeWindow>().IsAppHung)
  {...}
If you are able to identify the cdb.exe window with Spy please send us a snapshot.

You might also want to try version 2.1.4 which fixes a apphung-related problem.

Michael
Ranorex Team

cancerion
Posts: 30
Joined: Tue Jun 16, 2009 6:15 pm

Re: How to identify application state if application is hung?

Post by cancerion » Tue Oct 20, 2009 10:55 am

I tried this which is not working.

Can you please tell me how can I get the native window for a form?

Please suggest me that if my application got hang in step 3 and it is not allowing step4 to execute then how can I check the ‘AppHung’ property for my application.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to identify application state if application is hung?

Post by Support Team » Tue Oct 20, 2009 2:46 pm

You can get the native window using:

Code: Select all

NativeWindow formWindow = form.As<NativeWindow>()
What step is step 3 in your application ?

Michael
Ranorex Team