There are some situations in which a recovery scenarios won't work. Few of them are given below:
Even if we enable the recovery scenarios to be run on "On Every Step", it will not be activated on the first three steps, but it will be activated on the 4th step, because QTP only activates recovery scenarios on code statements which contain QTP test objects. Any pure VBScript code error can't be handled using recovery scenarios. So we can either use a dummy step like Window("hwnd:=-1 ").Exist(0) or we call use the statement below at any position to force the activation of recovery scenario:
'Activate the recovery scenario Recovery.Activate
The above statement forces execution of all enabled recovery scenarios associated with current test.
Case 2'Division by Zero
As explained in Case 1 the above error will not cause a recovery scenario to be activated, and can only be handled using the "On Error Resume Next" statement as described earlier.
'Access object not present in OR
In the above situation the object is not in the Object Repository and therefore can't trigger any recovery scenario. This type of exception occurs before QTP has a chance to execute the script's recovery scenario(s).
A recovery scenario cannot close a dialog box initiated by code statement inside QTP. Consider the following code statements:'Display a message box MsgBox
When the above statements are executed in a script which has a recovery scenario to dismiss unexpected modal dialogs, the scenarios won't be activated. Neither Recovery.Activate nor QTP recovery itself can close these message boxes. They either need to be closed manually or they need to be closed by some other process outside QTP. Note that we will write a VBScript in "Working with APIs" chapter to achieve this.
Problem. How can we get the status of an Action as Pass/Fail at the end of the action?
The key here is to execute a recovery scenario whose recovery action is a function call and mark the Action as failed when the function gets called. Create a recovery scenario as given below:Trigger Event:Test-Run error.
Test Run options: Proceed to next step
Now in every action we start the action with code as given below:'Disable all error messages
Using Qtp Help
Qtp Environment Variables
Descriptive Programming (dp)
Debugging In Qtp
Working With Apis
Qtp Automation Object Model
Working With Xml
Working With Databases
Working With Microsoft Excel
Working With Microsoft Outlook
Working With Microsoft Word
Working With Microsoft Internet Explorer
Working With Hp Quality Center
Working With .net Classes
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.