UFT/QTP – Recovery Scenario

Recovery Scenario is used to instruct UFT to recover from unexpected events and errors that occur in your testing environment during a run session.

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.

QTP Recovery Manager

 

key Elements of Recovery Scenario

Below are the key elements that are part of a Recovery Scenario:

  • Trigger Event: The event that interrupts your run session. For Example – a pop up window or a UFT run error
  • Recovery Operations: The operations to perform to enable UFT to continue running the test after the trigger event interrupts the run session. For Example – Clicking the ok button in pop up window or restarting Microsoft Windows.
  • Post- Recovery Test Run Option: The instructions on how UFT should proceed after the recovery operations have been performed and from which point in the test UFT should continue. For Example – you may want to restart a test from the beginning or skip a step entirely and continue with the next step in test.

Creating Recovery Scenario

Open Recovery Scenario Manager “Resources > Recovery Scenario Manager”.  Recovery Scenario manger dialog box will open as shown below.

QTP Recovery Scenario Manager

Click the New  scenario button, the Recovery Scenario Wizard opens as shown below:

QTP Recovery Scenario Wizard

Recovery Scenario Wizard contains the following five steps.

  1. Defining the trigger event that interrupts the run session
  2. Specifying the recovery operations required to continue
  3. Choosing a post-recovery test run operation.
  4. Specifying a name and description for the recovery scenario.
  5. Specifying whether to associate the recovery scenario to the current test and/or to all new tests.

There are four types of trigger events that disturb the script flow –

Event Type Raised Due to: Example
Pop Up Window Unexpected pop up window Work remainder window, Printer paper out pup up window
Test Run Error Return value of test script statement Item not available in the list box
Object State Change in property value of an object A button enabled from disabled state
Application Crash Crash of the application Application is terminated by an operation during run time.

Pop Up Window Recovery Scenario

Step 1. Select  “Resources > Recovery Scenario Manager”.  Recovery Scenario manger dialog box will open as shown below.

QTP Recovery Scenario Manager

Step 2. Click the New  scenario button, the Recovery Scenario Wizard opens as shown below:

QTP Recovery Scenario Wizard

Step 3. Click Next Button in Recovery Scenario Wizard. The Trigger Event Screen appears as shown below

QTP Recovery Trigger Event popup

Step 4. Select Pop-up Window and  click Next. Specify Pop-up window conditions screen appears as shown below.

QTP Pop-Up Window Operation

Step 5. Specify the pop-up window that is interrupting the run session using the pointing hand and click on next.

Step 6. Select any operation from the Recovery Operations screen as shown below. Select the default operation type Keyboard or mouse operation and click Next.

QTP Recovery Operation

Step 7. if you have selected Keyboard or mouse operation, the following dialog will be displayed asking to press keyboard key or button in the pop up window. Select  appropriately and click Next.

QTP Recovery Operation Mouse or Keyboard

uncheck the Add another recovery operation when you have added the operation and click Next.

QTP Recovery Operation Mouse or Keyboard Select

Step 8. post Recovery test run options screen opens as shown in below. Post-recovery test run options specify how to continue the run session after UFT has identified the event and performed all the specified recovery operations.

QTP Post Recovery Operation

Step 9. Select one of the Test run options from the above screen and click Next. Name & description screen appears as shown below.

Step 10. Enter the name & description for your recovery scenario and click Next to continue to completing the recovery scenario wizard screen.

Step 11. review a summary of the scenario setting and specify whether to automatically associate the recovery scenario with the current test. Click Finish.

Step 12. UFT adds pop up recovery scenario to the pop up dialog and handles it every time the dialog appears.

Object State Recovery Scenario

Step 1. Select  “Resources > Recovery Scenario Manager”.  Recovery Scenario manger dialog box will open as shown below.

QTP Recovery Scenario Manager

Step 2. Click the New  scenario button, the Recovery Scenario Wizard opens as shown below:

QTP Recovery Scenario Wizard

Step 3. Click Next Button in Recovery Scenario Wizard. The Trigger Event Screen appears as shown below

QTP Recovery Trigger Event Object

Step 4. Select Object State as your trigger event and  click Next.

Step 5. The Select object screen is displayed as shown below.

QTP Object Operation

Step 6. Click the pointing hand and then click the object whose properties you want to specify. Select the object and click OK.

Step 7. Click Next to continue to the set object properties and values screen.

Step 8. The object properties and values screen opens as shown below. Select properties and value for which recovery scenario should be triggered. Click Next.

QTP Object Properties Values

Step 9. Select any operation from the Recovery Operations screen as shown below. Select the default operation type Keyboard or mouse operation and click Next.

QTP Recovery Operation

Step 10. if you have selected Keyboard or mouse operation, the following dialog will be displayed asking to press keyboard key or button in the pop up window. Select  appropriately and click Next.

QTP Recovery Operation Mouse or Keyboard

uncheck the Add another recovery operation when you have added the operation and click Next.

QTP Recovery Operation Mouse or Keyboard Select

Step 11. post Recovery test run options screen opens as shown in below. Post-recovery test run options specify how to continue the run session after UFT has identified the event and performed all the specified recovery operations.

QTP Post Recovery Operation

Step 12. Select one of the Test run options from the above screen and click Next. Name & description screen appears as shown below.

Step 13. Enter the name & description for your recovery scenario and click Next to continue to completing the recovery scenario wizard screen.

Step 14. review a summary of the scenario setting and specify whether to automatically associate the recovery scenario with the current test. Click Finish.

Step 15. UFT adds pop up recovery scenario to the pop up dialog and handles it every time the dialog appears.

Test Run Recovery Scenario

Step 1. Select  “Resources > Recovery Scenario Manager”.  Recovery Scenario manger dialog box will open as shown below.

QTP Recovery Scenario Manager

Step 2. Click the New  scenario button, the Recovery Scenario Wizard opens as shown below:

QTP Recovery Scenario Wizard

Step 3. Click Next Button in Recovery Scenario Wizard. The Trigger Event Screen appears as shown below

QTP Recovery Trigger Event Test Error

Step 4. Select test run as your trigger event and  click Next.

Step 5. The Select test run error screen is displayed as shown below.
QTP Test Run Errors

Step 6. In the error list, select the run error that you want to use as the trigger event and click Next.

Step 7. Select any operation from the Recovery Operations screen as shown below. Select the default operation type Keyboard or mouse operation and click Next.

QTP Recovery Operation

Step 8. if you have selected Keyboard or mouse operation, the following dialog will be displayed asking to press keyboard key or button in the pop up window. Select  appropriately and click Next.

QTP Recovery Operation Mouse or Keyboard

uncheck the Add another recovery operation when you have added the operation and click Next.

QTP Recovery Operation Mouse or Keyboard Select

Step 9. post Recovery test run options screen opens as shown in below. Post-recovery test run options specify how to continue the run session after UFT has identified the event and performed all the specified recovery operations.

QTP Post Recovery Operation

Step 10. Select one of the Test run options from the above screen and click Next. Name & description screen appears as shown below.

Step 11. Enter the name & description for your recovery scenario and click Next to continue to completing the recovery scenario wizard screen.

Step 12. review a summary of the scenario setting and specify whether to automatically associate the recovery scenario with the current test. Click Finish.

Step 13. UFT adds pop up recovery scenario to the pop up dialog and handles it every time the dialog appears.

Application Crash Recovery Scenario

Step 1. Select  “Resources > Recovery Scenario Manager”.  Recovery Scenario manger dialog box will open as shown below.

QTP Recovery Scenario Manager

Step 2. Click the New  scenario button, the Recovery Scenario Wizard opens as shown below:

QTP Recovery Scenario Wizard

Step 3. Click Next Button in Recovery Scenario Wizard. The Trigger Event Screen appears as shown below

QTP Recovery Trigger Event Application Crash

Step 4. Select application crash as your trigger event and  click Next.

Step 5. The Select process screen is displayed as shown below. Select the process and click Next to continue to the recovery operations screen.

QTP Application Crash Recovery

Step 6. Select any operation from the Recovery Operations screen as shown below. Select the default operation type Keyboard or mouse operation and click Next.

QTP Recovery Operation

Step 7. if you have selected Keyboard or mouse operation, the following dialog will be displayed asking to press keyboard key or button in the pop up window. Select  appropriately and click Next.

QTP Recovery Operation Mouse or Keyboard

uncheck the Add another recovery operation when you have added the operation and click Next.

QTP Recovery Operation Mouse or Keyboard Select

Step 8. post Recovery test run options screen opens as shown in below. Post-recovery test run options specify how to continue the run session after UFT has identified the event and performed all the specified recovery operations.

QTP Post Recovery Operation

Step 9. Select one of the Test run options from the above screen and click Next. Name & description screen appears as shown below.

Step 10. Enter the name & description for your recovery scenario and click Next to continue to completing the recovery scenario wizard screen.

Step 11. review a summary of the scenario setting and specify whether to automatically associate the recovery scenario with the current test. Click Finish.

Step 12. UFT adds pop up recovery scenario to the pop up dialog and handles it every time the dialog appears.

Leave a Reply

Your email address will not be published. Required fields are marked *