-->Recovery Scenario Manager(OR)Exception Handling

Using Recovery scenario manager, we can handle the exceptions (unexpected errors) in the QTP script.
Using the Recovery Scenario Manager dialog box, you can then select any recovery file to manage all of the recovery scenarios stored in that file. This enables you to edit a selected recovery scenario, associate specific recovery scenarios with specific tests or components to instruct QuickTest to implement the recovery scenarios when specified trigger events occur, and so forth.
The following are the possible exceptions that can occur in the QTP script:
1.Pop-Up
2.Test Run Error
3.Application crash
4.Object State\Object Event

Pop-Up Exception: During the execution of the script some dialog box pop-up suddenly occurs which interrupts the execution of the script
Steps to handle Pop-up exception:
1.Ensure that the pop-up window is available
2.Select Resources --> Recovery Scenario Manager
3.Click on New Scenario(Image)--> Click on Next
4.Select the radio button ‘Pop-Up Window’ --> Click on Next
5.Click on the Hand icon
6.Click on the required pop-up window (captures the title & the message)
7.Implement the Regular Expression if required --> Click on Next
8.Select the Recovery operations ‘Keyboard or mouse operation’ --> Click on Next
9.Select the radio button ‘Click button with the label’ & click on the required button with the label --> Click on Next
10.Uncheck the check button ‘Add another recovery operation’--> Click on Next
11.Select the post recovery operation as ‘Repeat the current step & continue’ or ‘Proceed to next step’ (or as per the requirement)--> Click on Next
12.Provide the name & description --> Click on Next
13.Enable the check box ‘Add scenario to current test settings’
14.Click on Finish
15.Save the Recovery file.
Note: The recovery file will be saved as .qrs (QuickTest Recovery Scenario)

Steps to associate the recovery scenario file to the QTP script:
1.Select File --> Settings
2.Click on Recovery Tab --> Click on Add (+)
3.Select the required Recovery file
4.Click on ‘Add Scenario’ button
5.Click on Apply & OK

Script to associate the recovery scenario file to the QTP script:
Dim App 'As Application
Set App = CreateObject("QuickTest.Application")
App.Test.Settings.Recovery.Enabled = True
App.Test.Settings.Recovery.SetActivationMode "OnError"
App.Test.Settings.Recovery.Add "D:\Practise\QTP Testing\popupRS.qrs", "popupRS", 1
App.Test.Settings.Recovery.Item(1).Enabled = True

Steps to handle Pop-up exception by calling a Function:
1.Create an empty library file or use an existing library file
2.Select Resources --> Recovery Scenario Manager
3.Click on New Scenario --> Click on Next
4.Select the radio button ‘Pop-Up Window’ --> Click on Next
5.Click on the Hand icon
6.Click on the required pop-up window (captures the title & the message)
7.Implement the Regular Expression if required --> Click on Next
8.Select the recovery operation ‘Function Call’ radio button --> Click on Next
9.Select the required library file & define the required function --> Click on Next
10.Select the post recovery operation as ‘Repeat the current step & continue’ or ‘Proceed to next step’ --> Click on Next
11.Provide the name & description --> Click on Next
12.Enable the check box ‘Add scenario to current test settings’
13.Click on Finish --> Save the Recovery file.