There are 2 ways in which we can handle errors in QTP.
You may also like below topics on error handling in QTP.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
- Err object.
- Recovery Scenarios.
Sample code to handle the error is given below
If err.number <> 0 Then
print err.description
else
print "there was no error in above statement"
end if
Whenever any error occurs in the script, We get the message window with detailed description of the error.
But when we are executing the scripts, we do not want this message box to appear to come as this will halt the execution of the script.
To prevent message box from appearing, we use below statement above the block of code.
On error resume next
----------
----------
more statements
With On error resume next in place, QTP script runs even though error exists in the code. We can capture those errors using Err object as stated earlier.
When you are debugging the scripts, you should not use On error resume next statement as it will suppress the errors and you will not be able to figure out the issue in your script.
You may also like below topics on error handling in QTP.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs