Err object is very important in QTP. We can handle errors using this object. Whenever you think that error might occur, you can check if the error really occured or not using err.number
Example -
on error resume next
a = 2/0
'Above statement contains error - divide by zero.
if err.number <> 0 then
print "Error number is " & err.number & err.description
end if
Remember that you can use on error resume next anywhere and any number of times in the code.
To stop suppressing errors in QTP code you can use below statement.
On error goto 0
After this statement, if any error occurs, script will prompt you with the error message.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
Example -
on error resume next
a = 2/0
'Above statement contains error - divide by zero.
if err.number <> 0 then
print "Error number is " & err.number & err.description
end if
Remember that you can use on error resume next anywhere and any number of times in the code.
To stop suppressing errors in QTP code you can use below statement.
On error goto 0
After this statement, if any error occurs, script will prompt you with the error message.
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