Briefly review the session agenda as indicated here. Currently we are in the “Prep Session Introduction” section, during which we will review basic information about this session, including how to use Centra to participate. Note: The Prep Session Introduction section should take no longer than 15 minutes.
Spend a few moments answering participants’ questions about the agenda of this session or the Centra controls they will be using. Remind them to use the “Raise Hand” icon to ask a question.
Recovery Scenario in QTP
What is Recovery Scenario?
When to use Recovery Scenario?
Recovery Scenario Wizard
Properties of Recovery Scenarios
Setting Scenarios for the Tests
Using Recovery Object Methods.
While running a test in QTP there are certain Unexpected events,
errors, and application crashes which can distort your run session
and distort results.
This can result in the test run getting suspended until the occurred
event has been corrected.
User may have to again begin the complete test run which can be
tedious if the test script is very long or there are more than two or
tests called in the current run.
A Recovery Scenario helps the user as it indicates QTP with regards
the corrective action needed to be taken in case of the unwanted event
occurred during the test run.
Example is you can instruct QTP to detect a Printer out of paper
message and recover the run session by clicking the OK button to
the message and continue the test or component.
Recovery Scenarios are generally called by QTP on
occurrence of any
error during the test run.
Conditions where the user can predict any
unexpected event, it is
recommended to use optional steps or if conditions in
Recovery scenarios should be used only for
unpredictable events, or events that you cannot
synchronize with a specific step in your test or
User has to be careful while adding recovery
scenarios as it gets
activated only after a step returns an error, which
potentially occurs several steps after the one that
actually caused the
Alternatively, checking for trigger events after
every step, may slow
A Recovery scenario wizard helps the user in
defining recovery scenarios, save them and also
associate these to the corresponding tests. The
path is Tools>Recovery Scenario Manager> New
A recovery scenario wizard consists of the
Post-Recovery Test Run Option
Trigger Events: Indicates for which event the user needs to add an
Consists of the following events:
– Pop-up Window: A window pops up in an opened application during the test run.
– Object State: The property values of an object in your application match specified
values. You can specify property values for each object in the hierarchy.
– Test run error: A step in your test does not run successfully.
– Application crash: An open application fails during the test run.
QTP detects a pop-up window and identifies it
according to the window title and textual content.
In this the user has the option to set Window title
and/or contents within the Window making it
convenient to QTP in calling the corresponding
The user will have to initially
capture the screen user the
object spy for identification
Note: It is preferable that the user selects regular expressions option as it will help if any contents in the captured text
changes. Also if either Window title or text contains check box are not selected then QTP will not check for the
QTP detects a specific test object state and
identifies it according to its property values and
the property values of all its ancestors.
The user will have to identify the object using the
Object spy and the corresponding object or parent
properties get captured.
Further the user has the option to add or remove
certain properties that shall be used by QTP for
identification during scenario call.
Note: An object is identified only by its property values, and not by its class.
QTP detects a run error and identifies it by a
failed return value from a method. This option
consists of a list in the drop down box as shown
User selects any one of the error conditions and
the corresponding description for that error
occurs in the description box.
QTP detects an application crash and identifies it
according to a predefined list of applications
When the user selects this trigger event, he gets
an list of applications from which he will have to
select the applications that might cause a error.
Each time this application causes the error the
scenario is called.
In this screen the user defines the kind of recovery operation that
QTP needs to perform once the event has occurred.
The different operations are;
Key or mouse operation: The following operations can be performed
Clicks Default button or Enter key.
Clicks Cancel button or Esc key.
Click any button on the corresponding screen which the user can highlight by
using the Spy available
user can provide a combination of keys which the QTP will operate on the key
Close application: The processes declared by the user while defining the
Application crash trigger event shall be identified by QTP and closed once
this event occurs.
Function Call Screen: User has a option wherein he can call a function
stored in the Library depending upon the type of trigger event and the
Select Function option.
Restarting Microsoft Windows: This option will lead to sudden
termination of your script run and will close all the applications.
The user then gets the option to decide what QTP
will perform once the recovery operation is implied.
It will operate one of the following below given
Repeat current step and continue
Proceed to next step
Proceed to next iteration
Restart Current test run
Stop the Current Run
Once the user has completed creating the scenario
he will have the option to name the scenario and
User shall get all the conditions associated with
the corresponding scenario and will have an
Add the scenario to the Current test
Add scenario to default test settings.
The user can view the properties set to the
The user can also edit the created scenario, copy
the current to an new test and also delete the
The user can add a scenario to the test by Test>Settings and
in the dialog box select Recovery tab.
The user clicks on the “+”
symbol and gets an new box
from where he can import a
new recovery scenario and
insert it to the current test.
Also depending upon the
importance of the scenario
the user can either enable or disable
the current scenario through the check
The user can also prioritize the scenarios depending upon
their importance in the test using the arrow keys available.
User can utilize the Recovery object to control the recovery
programmatically during the run session.
User can also use the Recovery object's method to force QTP to check
for triggers after a specific step in the run session.
User can define a recovery scenario that looks for and closes specified
open processes when an object's properties have a certain state. This
state shows the object's property values as they would be if the
problematic processes were open.
User can instruct QTP to activate the recovery mechanism if the
checkpoint fails so that QTP will check for and close any problematic
open processes and then try to perform the checkpoint again.
Explicitly activates the recovery scenario mechanism at a specific point in the run.
Retrieves the name and source file of a recovery scenario, according to the specified position in
the list of recovery scenarios associated with the test or component.
Returns the position of a recovery scenario in the list of recovery scenarios associated with the
test or component, according to the specified name and source file.
Returns the status of a recovery scenario (True = enabled or False = disabled), according to
the specified position in the list of recovery scenarios associated with the test or
Enables or disables the specified recovery scenario, according to its position in the list of
recovery scenarios associated with the test or component.
Returns the number of recovery scenarios associated with the current test or component.
Recovery default property. Retrieves or sets the status of the recovery scenario mechanism for
the current test or component.
Recovery scenario helps the user to avoid any
interference during the test run.
During the Test run if any error occurs then QTP
calls any one of the recovery scenario assigned to
A single test can have more than one Recovery
It consists of Trigger event, Recovery operation,
Post-Recovery Test run options.
Recovery Object Methods are available to call and
activate the various scenarios.