---
description: A step by step instructions on how to use recovery scenarios to overcome unexpected errors
title: How to use Recovery Scenario in QTP/UFT with Example
image: https://www.guru99.com/images/how-to-use-recovery-scenario-in-qtp-uft.png
---

[Skip to content](#main)

**⚡ Smart Summary**

Recovery scenarios instruct UFT One to detect an unexpected event during a run session, perform a corrective operation, and then continue the test automatically instead of pausing an unattended run until somebody intervenes.

- 🔘 **Definition:** A recovery scenario pairs a trigger event with a recovery operation and a post-recovery instruction.
- ☑️ **Where it lives:** The Recovery Scenario Manager wizard under the Resources menu creates and stores every scenario.
- ✅ **Trigger events:** Pop-up window, object state, test run error and application crash are the four supported types.
- 🧪 **Recovery operations:** Keyboard or mouse action, close process, function call and restart Windows.
- 🛠️ **Post-recovery:** Six options decide whether the run repeats, skips, restarts or stops after recovery.
- ⚠️ **Alternative:** On Error Resume Next handles predictable VBScript errors inside a single step.

Read More

![How to use Recovery Scenario in QTP UFT with example](https://www.guru99.com/images/how-to-use-recovery-scenario-in-qtp-uft.png)

Using Recovery Scenarios you can instruct UFT One to recover from unexpected events and errors that occur in your [Testing](https://www.guru99.com/software-testing.html) environment during a run session.

Recovery scenario becomes crucial for large tests, which run unattended and are paused until a recovery operation is performed, increasing the test execution time.

**⚠️ Product naming:** the tool in this guide shipped as HP QuickTest Professional (QTP), became HP Unified Functional Testing, then Micro Focus UFT One, and is now sold by OpenText. The menu paths below are unchanged, so the steps still apply.

## Steps to use Recovery Scenario in QTP/UFT

There are **6 steps** involved in creating a recovery scenario

**Step 1)** In [UFT One](https://www.guru99.com/uft-qtp-automation-testing.html), Select Resources > Recovery Scenario Manager. Create new Scenario

**Step 2)** Specify the Trigger Event. A Trigger Event is an event that interrupts your run session

**Step 3)** Specify the Recovery Operation which is the corrective action you take when the trigger happens

**Step 4)** Specify Post-recovery test run options which specify how to continue the run session after [Quick Test Professional](https://www.guru99.com/uft-qtp-ide.html) has identified the event and performed all of the specified recovery operations.

**Step 5)** Check and verify Summary of the scenario you created.

**Step 6)** Add Recovery Scenario to your test using File > Settings > Recovery. The test results window show the details of the recovery scenario

Following video explains the steps in detail

Click [here](https://www.guru99.com/faq#faq1) if the video is not accessible  

**Note:** the wizard does not fire for a trigger that occurs in the very last step of a test. Add a spare step at the end when the final action can fail.

## Trigger Events Supported by UFT One

Step 2 above asks for a trigger event, and the wizard offers exactly four kinds. Choosing the right one matters, because each type recognises the interruption in a different way.

| Trigger event | How UFT One recognises it | Typical example |
| --- | --- | --- |
| Pop-up window | Window title and the text inside the window | A “printer out of paper” message box |
| Object state | Property values of the object and of all its ancestors | A button that is disabled while another process is open |
| Test run error | A failed return value from a method | A menu item that is missing at that point in the run |
| Application crash | A predefined list of applications | A secondary application that closes mid-run |

An object state trigger is matched per object, so if two objects reach the same state the recovery operations run twice, once for each match.

## Recovery Operations and Post-Recovery Run Options

Steps 3 and 4 define what happens once the trigger fires. The recovery operation is the corrective action, and UFT One supports four of them.

- **Keyboard or mouse operation** — click a named button in the window or send a key combination.
- **Close application process** — pick one or more running processes from the list and end them.
- **Function call** — run a VBScript function stored in an associated function library.
- **Restart Microsoft Windows** — the heaviest option, reserved for an unrecoverable environment.

Several operations can be queued in one scenario, and they execute in the order listed. The post-recovery option then tells the run session where to resume.

- Repeat current step and continue
- Proceed to next step
- Proceed to next action iteration
- Proceed to next test iteration
- Restart current test run
- Stop the test run

Pick *Repeat current step* when the pop-up simply blocked a click, and *Proceed to next test iteration* when the data row itself is the problem. A scenario saved through the wizard is stored in a .qrs file, so several tests can share it, and the order of scenarios attached to a test decides which one is applied first.

**Don't Miss:**

- [How to use Quick Test Professional IDE?](https://www.guru99.com/uft-qtp-ide.html)
- [Keyword and Expert View in QTP/UFT](https://www.guru99.com/uft-qtp-keyword-expert-view.html)
- [Local & Shared Object Repository in QTP/UFT](https://www.guru99.com/uft-qtp-local-shared-object-repository.html)
- [API Testing USING QTP/UFT: Complete Tutorial](https://www.guru99.com/api-testing-with-qtp-hp-uft.html)

## Handling Errors with On Error Resume Next

A recovery scenario answers an event nobody predicted. A predictable failure — a missing file, a value that fails to set — is cheaper to trap inside the script itself with [VBScript](https://www.guru99.com/vbscript-tutorials-for-beginners.html) error handling.

Use can also use statements

- **On Error Resume Next :** execution continues on the next line instead of stopping, and the failure is recorded in the Err object.
- **On Error GoTo 0 :** the default behaviour returns, so any later error stops the run again.

to handle errors in your script

The two statements work as a pair. Open the guarded region, check *Err.Number* straight after the risky line, report the result, clear the object, then close the region.

```
On Error Resume Next

SystemUtil.Run "notepad.exe"

If Err.Number <> 0 Then
    Reporter.ReportEvent micWarning, "Launch application", Err.Description
    Err.Clear
End If

On Error GoTo 0
```

**Note:** VBScript has no On Error GoTo \<label>. Only *Resume Next* and *GoTo 0* are valid, and the setting applies to the current procedure only.

| Situation | Better choice |
| --- | --- |
| Random pop-up or application crash | Recovery scenario |
| A single step that may legitimately fail | On Error Resume Next |
| Unattended overnight suite | Recovery scenario, so the run never waits |
| Validation that must be reported per step | On Error Resume Next with Reporter.ReportEvent |

## FAQs

🗂️ Where is a recovery scenario file stored?

The wizard saves each scenario in a shared recovery file with a .qrs extension. Because the file sits outside the test, several tests can associate the same scenario instead of each defining its own copy.

🔄 Why does my recovery scenario never fire?

Check three things: the scenario is associated with the test in the Recovery pane of Test Settings, the check box beside it is enabled, and the trigger is not in the final step, which the recovery mechanism does not monitor.

🔢 Does the order of associated scenarios matter?

Yes. UFT One applies scenarios in the listed order and stops at the first match, so move the most specific scenario to the top and leave broad catch-all scenarios at the bottom.

⚙️ When does UFT One check for a trigger event?

The activation setting decides: on every step, on an error only, or never. Checking on every step is the safest and the slowest, so reserve it for suites where stability matters more than run time.

🧹 What does Err.Clear actually do?

It resets Err.Number to zero and empties the description. Without it the previous failure stays in the object, and the next check reports an error that already happened.

🤖 Can AI predict which failures need a recovery scenario?

Machine learning over historical run logs clusters repeated interruptions by window title and error code, which shows the recurring pop-ups worth automating and separates them from one-off environment noise.

💻 Can GitHub Copilot write the VBScript for a recovery function call?

Yes. [GitHub Copilot](https://github.com/features/copilot) drafts the Err handling and the recovery function body from a comment, but verify the UFT One object names, because the model often suggests VBA syntax instead.

🛑 Should a recovery scenario ever stop the run?

Yes, when the application is unusable. Choosing Stop the test run prevents dozens of cascading false failures, and the results window still records the trigger that caused it.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.**

##### Sign up for the newsletter

Subscribe for Free

You have successfully subscribed.  
Please check your inbox.

![AI-Newsletter]() Chosen by over **350,000+** professionals

[Scroll to top](#wrapper)

×

Search for:

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/how-to-use-recovery-scenario-in-qtp-uft.png","url":"https://www.guru99.com/images/how-to-use-recovery-scenario-in-qtp-uft.png","width":"700","height":"250","caption":"How to use Recovery Scenario in QTP/UFT","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/qtp","name":"UFT"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html","name":"How to use Recovery Scenario in QTP/UFT with Example"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#webpage","url":"https://www.guru99.com/uft-qtp-recovery-scenario.html","name":"How to use Recovery Scenario in QTP/UFT with Example","dateModified":"2026-10-10T17:10:24+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/how-to-use-recovery-scenario-in-qtp-uft.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/editorial","name":"Editorial Team","url":"https://www.guru99.com/author/editorial","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/favicon-new-logo.png","url":"https://www.guru99.com/images/favicon-new-logo.png","caption":"Editorial Team","inLanguage":"en-US"},"sameAs":["https://www.guru99.com/editorial-team"],"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"UFT","headline":"How to use Recovery Scenario in QTP/UFT with Example","description":"A step by step instructions on how to use recovery scenarios to overcome unexpected errors","keywords":"qtp","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/editorial","name":"Editorial Team"},"dateModified":"2026-10-10T17:10:24+05:30","image":{"@id":"https://www.guru99.com/images/how-to-use-recovery-scenario-in-qtp-uft.png"},"copyrightYear":"2026","name":"How to use Recovery Scenario in QTP/UFT with Example","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Where is a recovery scenario file stored?","acceptedAnswer":{"@type":"Answer","text":"The wizard saves each scenario in a shared recovery file with a .qrs extension. Because the file sits outside the test, several tests can associate the same scenario instead of each defining its own copy."}},{"@type":"Question","name":"Why does my recovery scenario never fire?","acceptedAnswer":{"@type":"Answer","text":"Check three things: the scenario is associated with the test in the Recovery pane of Test Settings, the check box beside it is enabled, and the trigger is not in the final step, which the recovery mechanism does not monitor."}},{"@type":"Question","name":"Does the order of associated scenarios matter?","acceptedAnswer":{"@type":"Answer","text":"Yes. UFT One applies scenarios in the listed order and stops at the first match, so move the most specific scenario to the top and leave broad catch-all scenarios at the bottom."}},{"@type":"Question","name":"When does UFT One check for a trigger event?","acceptedAnswer":{"@type":"Answer","text":"The activation setting decides: on every step, on an error only, or never. Checking on every step is the safest and the slowest, so reserve it for suites where stability matters more than run time."}},{"@type":"Question","name":"What does Err.Clear actually do?","acceptedAnswer":{"@type":"Answer","text":"It resets Err.Number to zero and empties the description. Without it the previous failure stays in the object, and the next check reports an error that already happened."}},{"@type":"Question","name":"Can AI predict which failures need a recovery scenario?","acceptedAnswer":{"@type":"Answer","text":"Machine learning over historical run logs clusters repeated interruptions by window title and error code, which shows the recurring pop-ups worth automating and separates them from one-off environment noise."}},{"@type":"Question","name":"Can GitHub Copilot write the VBScript for a recovery function call?","acceptedAnswer":{"@type":"Answer","text":"Yes. GitHub Copilot drafts the Err handling and the recovery function body from a comment, but verify the UFT One object names, because the model often suggests VBA syntax instead."}},{"@type":"Question","name":"Should a recovery scenario ever stop the run?","acceptedAnswer":{"@type":"Answer","text":"Yes, when the application is unusable. Choosing Stop the test run prevents dozens of cascading false failures, and the results window still records the trigger that caused it."}}]}],"@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#schema-595986","isPartOf":{"@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#webpage"}},{"@type":"VideoObject","embedUrl":"https://www.youtube.com/embed/S8MNbyJYH0Y","name":"How to use Recovery Scenario in QTP/UFT with Example","description":"A step by step instructions on how to use recovery scenarios to overcome unexpected errors","uploadDate":"2020-01-24T00:00:00+05:30","thumbnailUrl":"https://i.ytimg.com/vi/S8MNbyJYH0Y/maxresdefault.jpg","hasPart":[],"width":"640","height":"390","@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#schema-595988","isPartOf":{"@id":"https://www.guru99.com/uft-qtp-recovery-scenario.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"}]}
```
