When we run a test or
a batch of test in QTP, tests may start failing in case application crashes or
a pop up window appear during test execution. QTP needs to recover from such
error and continue with execution of test script. QTP provides creating
recovery scenario through recovery scenario manager so that the tests are
executed uninterrupted. In this article we will discuss on recovery scenarios.
QTP enables user to create recovery scenarios and associate them with specific tests. Recovery scenarios activate specific
recovery operations when trigger events occur. Recovery scenarios are intended for use
only with events that cannot be predicted in advance, or for events that cannot
otherwise be synchronized with a specific step in the test.
The Recovery Scenario Manager provides a
wizard that guides through the process of defining a recovery scenario, which
includes a definition of an unexpected event and the operations necessary to
recover the run session.
A recovery scenario consists of the
following:
•
Trigger Event. The event that interrupts
run session. This can be application error or a pop up window appearing
•
Recovery Operations. The operations to perform to enable QTP to continue running the test
after the trigger event interrupts the run session.
•
Post-Recovery Test Run
Option. The instructions on how QTP should proceed
after the recovery operations have been performed
Following are the steps in creating recovery scenario using recovery scenario
manager:
- Create a new scenario
- Define the trigger events
- Define recovery operation
- Define post recovery operation
- Naming the scenario and associating with test.
Step 1: Creating a new Scenario
Select Resources > Recovery Scenario
Manager.
Step 2: Define Trigger Event
Select the required trigger Event and click
on next button
A Trigger event can be one of the
following:
•
Pop-up Window
•
Object State
•
Test run error
•
Application Crash
Step 3: Recovery
Operation:
This page enables to manage the collection of recovery
operations in the recovery scenario. A recovery Operation can be one of the
following:
•
Keyboard or mouse operation
•
Close application process
•
Function call
•
Restart Microsoft Windows
Step 4: Post-Recovery
Test Run Options Page
This page
enables to define post-recovery test run
options, which specify how to continue the run session after QTP has identified
the event and performed all of the specified recovery operations.
Following are
the options available post recovery:
•
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
Step 5: Completing the Recovery
Scenario Wizard Page
This page enables to review a summary of the scenario
settings defined and provide option to
add scenario to current test.
Useful Info: We have an existing recovery scenario that covers common errors and issue for Recovery . The file is available in "C:\Program Files\HP\QuickTest Professional\recovery\WebRecovery.qrs". Do have a look, this will be very useful to use existing recovey scenario for most of common error