How do I tell QTP/UFT on an error to stop the entire script?
Do I use the global setting for this?
Is it better to use the global setting "on error go to next line" and then check err.number and err.description on occasion to abort?
After all of these years with QTP, I have not had much luck with the error handler in VBScript or the global settings. On top of it the EXITxxx commands don't work in the libraries when the global setting tells the code to go to the next line on an error.
Better not to go with the global setting and use the "on error resume next" whenever required as this would work in the libraries perfectly.
But as you said, the exit statements wont work when thr is error - this is true and hope you remember our discussion on "http://www.sqaforums.com/forums/hp-unified-functional-testing-uft-mercury-quicktest-pro-qtp/150461-possible-stop-script-when-fails-3.html"
So whenever you wanted to quit based on the errors, report those errors - put "on error goto 0" -and then your Exit statements.
But any specific case you are looking, let us know
I took a look at the conversation.
I guess the best choice is to NOT use the global go to next line on a fail. Instead use
On Error Resume Next in each function in the libraries?
Then the ExitXXX statements will still work.
Is the idea that I check for things that should not occur such as a missing object, other illegal situations. Then report them and use and EXITTEST to go to the next test?
instead of using .SET and .Edit, I'm thinking of passing objects into functions that do a bit of testing and reporting and using EXITTEST when things go wrong.
I feel as if I'm asking the same questions repetitively. I'm sorry if I'm being a bother to anyone. I feel like this should be very easy to implement and I have seen many people do this many ways. I have to build a big project and I'd like to get the main idea working from the start.