Page 1 of 1

How to identify application state if application is hung?

Posted: Thu Aug 06, 2009 12:51 pm
by cancerion
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

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

Posted: Thu Aug 06, 2009 4:56 pm
by Support Team
You might want to try the NativeWindow adapter (from your Form) which contains a property named
"AppHung"

Michael
Ranorex Team

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

Posted: Thu Sep 17, 2009 9:09 am
by balajichandan
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?

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

Posted: Thu Sep 17, 2009 12:37 pm
by Support Team
Could you please describe in more detail what you are trying to accomplish and what is running where (including Ranorex).

Regards,
Michael
Ranorex Team

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

Posted: Thu Sep 17, 2009 1:14 pm
by balajichandan
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.

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

Posted: Thu Sep 17, 2009 2:06 pm
by Support Team
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

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

Posted: Tue Oct 20, 2009 10:55 am
by cancerion
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.

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

Posted: Tue Oct 20, 2009 2:46 pm
by Support Team
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