QTP is having a special feature called as “Recovery Scenario” for handling unexpected behaviors (e.g appearance of pop-up windows) of the application during the test execution.
We need to do two steps for using recovery Scenario. One is creating recovery Scenario file (.qrs file) and another step is associating the recovery scenario to the Tests.
We can use recovery scenario manager/wizard for creating recovery scenario file.
The Recovery Scenario Wizard allows you to create recovery scenario file by step-by-step process.
The Recovery Scenario Wizard contains five main steps
Ø Defining the trigger event (Pop-up window, Object state, Test run error, Application crash) that interrupts the run session
Ø Specifying the recovery operation(s) required to continue. We must define at least one recovery operation. And, we can add more than one recovery operations also.
Ø Choosing a post-recovery test run operation from the list of various options such as Repeat current step and continue, Proceed to next step, Proceed to next action or component iteration, Proceed to next test iteration, Restart current test run, Stop the test run
Ø Specifying a name and description for the recovery scenario.
Ø specifying whether to associate the recovery scenario to the current test and/or to all new tests
You open the Recovery Scenario Wizard by clicking the New Scenario button in the Recovery Scenario Manager Dialog box (Resources > Recovery Scenario Manager).
And, we can associate one or more scenarios with a test in order to instruct QTP to execute the recovery scenario(s) during the run session if a trigger event occurs.
We can add/Enable the required recovery scenario from the Recovery Tab of “Test Settings” window.
Any one of below options can be selected for activating the Recovery Scenario.
- On every step—The recovery mechanism is activated after every step.
- On error—The recovery mechanism is activated only after steps that return an error return value.