How does recovery scenario works in UFT? I mean how does UFT knows when to implement the recovery scenario during run time?
-
I think This belongs to [superuser](superuser.com) – yukashima huksay Jun 03 '18 at 17:15
4 Answers
UFT controls the VBScript engine that runs the test, when it sees that an error occurred in a step it checks if there is a relevant recovery scenario registered to handle this error. If so it runs the recovery scenario rather than pass the error back to the test.
I don't see how this information is useful for test automation engineers.

- 110,860
- 49
- 189
- 262
You create recovery Scenarios with a wizard in the UFT IDE. As part of the steps you can define what are the triggering criterias for this recovery scenario (Examples: Runtime error, a specific dialog appeared, at each step etc). If the recovery scneario is triggered there are actions what you can take in order to remedy the situation. Most of the time you want to execute a function and so on..... All this info is found in the Microfocus (HPE) Documentation.
What is less-known is that recovery scenario triggers are looking only at the steps in an Action. If you've gone away from an Action Based framework but use mostly functions to classify your keywords - well then recovery scenarios are useless for you - they are not triggered; just ignore them - and use plain old VBS error handling with lots of code and On Error Resume Next.
Recovery Scenarios are event-based while On Error Resume Next type error handlings have to be always deterministic (You always have to know where an unexpected popup may appear and handle it).
Long Story Short: The event-based nature of Recovery Scenarios would be a big advantage in error handling but it can be used only in an action based framework which on the other side is very bad with Resource Management and development easiness, so most people tend to abandon it

- 714
- 5
- 10
Seems it's late but i would like to answer this as I had worked with those scenarios quite often. You can use recovery scenarios whenever you can expect some unexpected scenario to occur. Quite often while working on older Virtual machines I faced errors of Internet explorer crashing and sometime Excel crashing or Java application crashing etc.As these things can happen at any point of time, may be in your first line of code or may be at last line. So to handle such unexpected conditions we can use recovery scenarios.
Next, how to create and activate a recovery scenarios: Navigate to Resources-> Recovery scenario manager-> Select the condition for which you want to create a rec scenario-> Provide post recovery step-> Name it , save it and assosciate it to your current test.
Hope this helps. Please write if anything else required.

- 46
- 1
- 3
Recovery scenario can, and will be triggered from any function library associated with the test, and not only from the action script file. It is used by automation test engineers.
There is an option to decide whether you want it to be triggered on errors only, or on every step (GUI steps, meaning that: Dim i ==> i=7
etc... will not trigger the recovery).
Setting it to launch on every step will cause a performance issue, but with today's new machines, you hardly noticed it. Just run the same test (long enough) with and without this setting and measure the test duration to determine.
Example that can be easily tested: In most applications, the save button will save the new changes to the opened file, but if this is a new file, it will prompt the user where to save it. Usually, when this dialog (Save) is opened, the user cannot work on the application.
Now, set up a matching recovery to handle the Save dialog, write a script that performs some activities, pressing the Save button (new file), and continues clicking the application. Because the save dialog will (probably) block next activity, UFT will trigger the recovery mechanism, and run its code.
You can place a breakpoint there, and debug it just like any other code.

- 25,496
- 15
- 91
- 179

- 34
- 4