Recovery Scenarios In QTP

We may come across some unexpected errors or exceptions during our test case execution. Consider the following scenario. Assume that after every step of the execution, we need to print the result.So, we need to call the printer from our script. Assume that the printer is out of paper.Obviously we will get the  message "Printer Out of Paper" pop up. This is an unexpected behavior results in test cases failure. So, we should have a mechanism to handle these type of unexpected behaviors.To handle these type of unexpected behaviors we have recovery scenarios in QTP.

We can use "On Error Resume Next"  or "if step" in our script if we know the exact place in which the exception occurs every time based on the scenario.But sometimes we can't handle the above mentioned scenario directly in test cases. Because we don't know that the time taken by network  to respond when the printer is out of paper. By that time the script could have crossed the step which handles the unexpected behavior. So, our test case will fail. In such conditions,it's always better to use recovery scenarios.

The main important to remember when using the recovery scenarios are as follows.

Trigger Event: Trigger the event which causes the script execution interruption.For example, we can say that the pop up which displays the printer out of paper message.

Recovery Option: The operations to be performed to enable QTP to continue the script execution.As per our example, we need to clock on "OK" button in the pop up window which causes the script interruption.

Post Recovery Operation: The operation which represents the actions to be performed after recovery. It means that from which step script execution to be started. For example, we can restart the test execution from beginning or skip the step which causes interruption.

Recovery scenarios will be stored with the file extension ".rs".A recovery scenario file is a logical collection of recovery scenarios, grouped according to your own specific requirements. By default, QTP checks for recovery triggers when an error is returned during the run session. You can use the Recovery object's method to force QTP to check for triggers after a specific step in the run session. 
For the complete list of recovery scenarios go to QTP Documentation > Quick Test Advanced References > Quick Test Automation > Recovery Object.
SHARE

About அமரகோசம்

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment