Recovery Scenarios in QTP:
Unexpected events, errors, and application crashes during a run session can disrupt your run session and distort results. This is a problem particularly when running tests or components unattended, the test or component is suspended until you perform the operation needed to recover.
The Recovery Scenario Manager provides a wizard that guides you through the process of defining a recovery scenario-a definition of an unexpected event and the operation(s) necessary to recover the run session. For example, 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 an continue the test or component.
A recovery scenario consists of the following:
· Trigger Event: The event that interrupts your run session. For example, a window that may pop up on screen, or a QTP run error.
· Recovery Operation(s): The operation(s) that need to be performed in order to continue running the test or component. For example, clicking an OK button in a pop-up window, or restarting Microsoft Windows.
· Post-Recovery Test Run Option: The instructions on how QTP should proceed once the recovery operations have been performed, and from which point in the test or component QTP should continue, if at all. For example, you may want to restart a test or component from the beginning, or skip a step entirely and continue with the next step in the test or component.
Recovery scenarios are saved in recovery scenario files. A recovery scenario file is a logical collection of recovery scenarios, grouped according to your own specific requirements.
To instruct QTP to perform a recovery scenario during a run session, you must first associate it with that test or component. A test or component can have any number of recovery scenarios associated with it. You can prioritize the scenarios associated with your test or component to ensure that trigger events are recognized and handled in the required order.
When you run a test or component for which you have defined recovery scenarios and an error occurs, QTP looks for the defined trigger event(s) that caused the error. If a trigger event has occurred, QTP performs the corresponding recovery and post-recovery operations.
You can also control and activate your recovery scenarios during the run session by inserting Recovery statements into your test or component.
Recovery Scenario Functions:
Here, we will define a Function Call and use that Function Call to handle the error. The default syntax for the Recovery Scenario Function is:
Function ProjRecovery(Object, Method, Arguments, retVal)
'Error Handling Code
End Function
Recovery Scenario Functions:
Here, we will define a Function Call and use that Function Call to handle the error. The default syntax for the Recovery Scenario Function is:
Functions should have 4 parameters:
Function FunName (Object, Method, Arguments, retVal)
--------------------------------
--------------------------------
End Function
Object here refers to the object which has triggered the recovery scenario, Method of that object, Arguments and retVal.
When the recovery scenario is triggered, all 4 parameters will be passed to the function automatically by QTP
'Error Handling Code
End Function
No comments:
Post a Comment