2. Recovery Scenarios
What is Recovery Scenario?
When to use Recovery Scenario?
Recovery Scenario Wizard
Trigger Events
Recovery Operations
Post-Recovery Operation
Naming
Properties of Recovery Scenarios
Setting Scenarios for the Tests
Using Recovery Object Methods.
Session Wrap-Up
pgorantla.blogspot.com
3. Recovery Scenarios
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
more
tests called in the current run.
A Recovery Scenario helps the user as it indicates QTP with regards
to
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
close
the message and continue the test or component.
pgorantla.blogspot.com
4. Recovery Scenarios
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
the script.
Recovery scenarios should be used only for
unpredictable events, or events that you cannot
synchronize with a specific step in your test or
component.
pgorantla.blogspot.com
5. Recovery Scenarios
User has to be careful while adding recovery
scenarios as it gets
activated only after a step returns an error, which
can
potentially occurs several steps after the one that
actually caused the
error.
Alternatively, checking for trigger events after
every step, may slow
performance.
pgorantla.blogspot.com
6. Recovery Scenarios
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
scenario.
A recovery scenario wizard consists of the
following;
Trigger events
Recovery Operation
Post-Recovery Test Run Option
Name
Finish
pgorantla.blogspot.com
7. Recovery Scenarios
•
Trigger Events: Indicates for which event the user needs to add an
recovery scenario.
•
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.
pgorantla.blogspot.com
8. Recovery Scenarios
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
scenario.
The user will have to initially
capture the screen user the
object spy for identification
by QTP.
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
corresponding option.
pgorantla.blogspot.com
9. Recovery Scenarios
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.
pgorantla.blogspot.com
10. Recovery Scenarios
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
below.
User selects any one of the error conditions and
the corresponding description for that error
occurs in the description box.
pgorantla.blogspot.com
11. Recovery Scenarios
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.
pgorantla.blogspot.com
12. Recovery Scenarios
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
board.
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.
pgorantla.blogspot.com
13. Recovery Scenarios
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
conditions;
Repeat current step and continue
Proceed to next step
Proceed to next iteration
Restart Current test run
Stop the Current Run
pgorantla.blogspot.com
14. Recovery Scenarios
Once the user has completed creating the scenario
he will have the option to name the scenario and
description.
User shall get all the conditions associated with
the corresponding scenario and will have an
option;
Add the scenario to the Current test
Add scenario to default test settings.
pgorantla.blogspot.com
15. Recovery Scenarios
The user can view the properties set to the
created scenario.
The user can also edit the created scenario, copy
the current to an new test and also delete the
scenario.
pgorantla.blogspot.com
16. Recovery Scenarios
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
box
The user can also prioritize the scenarios depending upon
their importance in the test using the arrow keys available.
pgorantla.blogspot.com
17. Recovery Scenarios
User can utilize the Recovery object to control the recovery
mechanism
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.
pgorantla.blogspot.com
18. Recovery Scenarios
Method/Property
Description
Activate Method
Explicitly activates the recovery scenario mechanism at a specific point in the run.
GetScenarioName Method
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.
GetScenarioPosition
Method
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.
GetScenarioStatus Method
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
component.
SetScenarioStatus Method
Enables or disables the specified recovery scenario, according to its position in the list of
recovery scenarios associated with the test or component.
Count Property
Returns the number of recovery scenarios associated with the current test or component.
Enabled Property
Recovery default property. Retrieves or sets the status of the recovery scenario mechanism for
the current test or component.
pgorantla.blogspot.com
20. Recovery Scenarios
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
the test.
A single test can have more than one Recovery
Scenario.
It consists of Trigger event, Recovery operation,
Post-Recovery Test run options.
Recovery Object Methods are available to call and
activate the various scenarios.
pgorantla.blogspot.com
Notes de l'éditeur
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.