Friday, November 12, 2010

CoolTuts - QTP - Recovery Scenario Manager

Unexpected events, errors and application crashes during a run session can disrupt your run session and distort results. This is a problem particularly when tests run unattended - the test pauses until you perform the operation needed to recover. To handle such situation, QTP enables you to create recovery scenarios and associate them with specific tests.

If you can predict that a certain event may happen at a specific point in your test, it is highly recommended to handle that event directly within your test by adding steps such as if statements or optional steps, rather than depending on a recovery scenario. By default, recovery scenario operation are activated only after a step returns an error.

Creating a Recovery Scenario File

Go to Resources > Recovery Scenario Manager.

Click on New Scenario Button

Click on Next. Select Trigger Event Dialog Box opens.

This screen displayed in the wizard depends on which of the following trigger types you select.
1. Popup Window
2. Object State
3. Test Run Error
4. Application Crash

Using this option (Window title and/or Window text) instructs QTP to identify any pop-up window that contains the relevant title and/or text. Click on Hand button and show the popup window which is popup.

Click on Next Button.

Using this we can select an object for which we have to create recovery. Click on Hand button and show the object

Click on Next Button

Select the type of error for which you want to create recovery and click on Next.

Running process displays all application processes that are currenly running. The processes list displays the application processes that will trigger the recovery scenario if they crash.

Click on Next Button to the Recovery operations Screen and again click on next for recovery operations.

Select the type of recovery operation and click on next.
Keyboard or mouse operation
QTP simulates a click on a button in a window or a press of a keyboard key. Select this option and click on Next to continue to the Recovery Operation.

Close application process
QTP closes specified processes. Select this option and click on Next to continue to the Recovery Operation - Close Processes Screen.

Function call
QTP calls a VBScript function. Select this option and click Next to continue to the Recovery Operation - Function Call Screen.

Restart Microsoft Windows
QTP restarts Microsfot Windows. Select this option and click Next to continue to the Recovery Operations Screen.

If you select function call then this screen will be displayed. By clicking on browse button select the recovery function, if it already available. Else Select Define new function to define now.

Click on Next for Post Recovery Operations.

Post Recovery Operations
Repeat current step and continue: Repeat the current step that QTP was currently running when recovery scenario is triggered.
Proceed to next step This skips the step that QTP was running when the recovery scenario was triggered
Proceed to next step or component Goes to next action iteration after completion of recovery operation
Proceed to next test iteration Goes to next test iteration after completion of recovery operation
Restart current test run To restart the testrun after completion of recovery operation
Stop the test run To Stop the Entire Test run.

Enter a name and a textual description for your recovery scenario, and click Next to continue to the completing the Recovery Scenario Wizard Screen.

In the Completing the Recovery Scenario Wizard screen, you can review a summary of the scenario settings you defined. You can also specify whether to automatically associate the recovery scenario with the current test and/or to add it to the default settings for all new tests.

Click on Finish, save the scenario and Scenario File. If you want to use this scenario for any test you need to associate the scenario to a test.

No comments:

Post a Comment