Book Image

Advanced UFT 12 for Test Engineers Cookbook

Book Image

Advanced UFT 12 for Test Engineers Cookbook

Overview of this book

Table of Contents (18 chapters)
Advanced UFT 12 for Test Engineers Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating and using a recovery scenario


UFT also enables us to define a specific behavior to handle a wide array of situations in advance. For example, instead of having to check our code for the existence of an unhandled pop-up dialog that may interfere with the normal flow of our test, we can use a recovery scenario to instruct UFT what to do if such is found. For example, we may tell UFT to close the dialog and try to rerun the step that failed due to the existence of the dialog. Another option, would be to tell UFT to exit the current Action or test iteration (in such cases, we must ensure that the test or Action begins in the proper context, that is, with the initial set of conditions). A simple case of a pop-up dialog is that of Notepad's warning when we try to close the application without having saved the document:

We can use a recovery scenario to handle the pop-up dialog, and this way, we will not have to refer to it in our code. The recovery scenario mechanism is a trap for the...