Saturday, 26 September 2015

Recovery Scenarios in QTP

While executing the QTP scripts, we might get some unexpected errors. In order to overcome these errors and recover the test and continue executing the rest of the script from these unexpected errors, we use Recovery Scenarios in QTP. The Recovery Scenario Manager can be accessed by Navigating to "Resources" → Recovery Scenario Manager. Generally a recovery scenario consists of the following
  • Trigger event
  • Recovery operations
  • Post recovery Test Run Object

Trigger Event:


The event that interrupts your run session like there may be a window pop up on the screen or an advertisement
Recovery operations:
The operations which performs to enable QTP to continue running the test after the trigger event interrupts the Run session are called as Recovery operations. For example if there is trigger event like a pop up window has been apprered on the screen if click Ok or Cancel button the window gets closed, So the Ok and Cancel buttons are known as recovery operations

Post recovery Test Run Object:
The instructions on how QTP should proceed after the recovery operations have been performed and from which point in the test the QTP should continue and all will be handled by this option. For example, if we want to restart a test from the beginning, or skip a step entirely and continue with the next step in the test. Recovery scenarios are saved in the recovery scenario files and they have an extension .qrs. A recovery scenario files is a logical collection of recovery scenarios, grouped according to our specific requirements.
Recovery scenario manager can handle the following four events
  • Pop Up windows: It handles unwanted pop ups
  • Object State: It handles object related errors during the runtime.
  • Test run error: It handles Vb script statement errors at runtime
  • Application Crash: It handles crashed applications at runtime

Recovery scenario become crucial for large tests, which run unattended and are paused until recovery operation, is performed increasing the test execution time.
There are 6 steps involved in creating a recovery scenario
  1. Step 1) In QTP , Select Resources > Recovery Scenario Manager .Create new Scenario
  2. Step 2) Specify the Trigger Event.  A Trigger Event is an event that interrupts our run session
  3. Step 3) Specify the  Recovery Operation which is the corrective action we take when trigger happens
  4. Step 4) Specify Post-recovery test run options which can specify how to continue the run session after Quick Test  Professional has identified the event and performed all of the specified recovery operations.
  5. Step 5) Check and verify Summary of the scenario we created.
  6. Step 6) Add Recovery Scenario to our test using  File > Settings > Recovery. The test results window show the details of the recovery scenario
  7. We can also use statements

·         On Error Resume Next :
·         On Error Go to 0 :
In order to handle errors in our script










No comments:

Post a Comment