Frage

I'm writing a series of test set automation suites in HP UFT 12. The trouble is we need to know when/if the browser is hanged to prevent UFT from also hanging or throwing an error message and waiting for the user to respond. The trouble is that if the test is run then nobody will be able to respond to it until the morning. We would like to log the error and continue with the next test iteration if possible. The trouble is there seems to be no way to detect if the browser has hanged.

Example: So I have this test script. It checks for objects and does some work on the browser window. The trouble is that if an item on the browser doesn't exist, it might not be a total failure, just that the action for that item cannot be performed. So simply checking if objects exist isn't the answer, and besides simply checking if an object exists doesn't guarantee that it might exist but be hidden or moved off-screen. (for anybody who's been writing code in QTP/UFT for any length of time will know)

So imagine that I'm running this test. And while the test is executing I take control of the browser that it is driving and type in the URL: www.crashie8.com which promptly crashes the browser simulating a hang. Now is when things get interesting.

QTP/UFT should be able to deal with this. If I leave the code unchanged UFT will eventually throw an error message, which, as described above, doesn't help me.

I can add the line "On Error Resume Next" at the beginning of every function/test script, but this promptly hangs UFT, then everything is hanged and it's just a big-ole-traffic pile-up on my desktop!

Doing anything such as "On Error ExitAction" or "On Error ExitTest" or "On Error ExitActionIteration" or "On Error ExitGlobalIteration" all give compile-time errors "Invalid Syntax"

Maybe I'm missing some capability that I didn't know or understand in the Check Points or the Recovery Scenerios?

EDIT: The solution: Go into the Script Settings->Run and setting the option: "When error occurs during run session: Stop run". The Run results will display errors indicating that there was a failure identifying the browser.

Doesn't work fully. While the option "Stop Run" will indeed stop the run, it stops the run even if an object is misidentified, however, when such a simple error happens the script should be able to continue. So setting the option to "Continue with next step" will solve the problem of continuing with small errors, but will still hang UFT/QTP when the browser hangs. Also the option "Continue with next Action Iteration" has the same problem. So there appears to be no middle ground, and there doesn't appear to be any code that can solve this problem either.

I suppose the only possible solution for now is the option "Stop Run" although it is very annoying that it would kick all the way out and there is no way to continue at all in any way, and all of the other continue options similarly fail, and there is no coding solution. Because On Error ExitAction doesn't even let you save thanks to a syntax error that shouldn't even really be an error?! Any other options that anybody has developed?

EDIT: I guess the "Stop Run" doesn't even work every time either. There has got to be a better solution! Anybody?

Figured out that the likely cause of the UFT/QTP crash is because of the IE plugin. But cannot disable the IE plugin, because UFT/QTP won't be able to test against IE without it. So yet again we are in a catch22! Seriously, hasn't anybody at HP thought about this stuff?!

War es hilfreich?

Lösung

Solution: Go into the Script Settings->Run and setting the option: "When error occurs during run session: Stop run". The Run results will display errors indicating that there was a failure identifying the browser. If the iexplorer.exe process-tree is killed then UFT will recover. Therefore this is about the only solution, albeit not a very good one, it's actually more of a work-around then a bonafide solution.

"Above option is when UFT prompt some error but at time of crash its not prompting any error"

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top