Error Handling in QTP
Is there any possibilities to get the error occured line no while executing in unattended mode? I hope below is the some of ways to handle in other automation tools
1. On Error Goto ErrHandler
- This will be the placed in the beginning of the method and ErrHandler will be placed in End of method. This will gives the quick visiblity of error occured line with err description.
Rational Functional Tester
1. Parse the Exception Stack Trace and get the Line #, method name and class name.
3. Using Try and Catch Block
How about QTP?
I hope we cant use On Error Goto ErrorHandler, It supports On Error Resume Next and We cant prediate when error will occur.
After selection of Radio Button, appropriate Select box will be loaded with data. Script will take the data from combo box and proceed the operation. If combobox is not loaded on time, rest of the code will fail.
Is Recovery Scenario will satify this feature?
Your comments are highly appriciated. [img]/images/graemlins/laugh.gif[/img] [img]/images/graemlins/wink.gif[/img]
Re: Error Handling in QTP
Try by changing the function structure as given below.
Check for error number before doing the operation. If no error is present the error number will be 0.Any non 0 number indicates that there are some errors in the execution. hence we can handle the error scenarious in un attented mode.
On error resume next
'Script Statements to click on Radio button
'Script statements to select value from Select Box
'Check error number
If Err.number <>0 Then
'Error handling operations or call another function to do it
'Exit from function
'Proceed with the rest of steps