Building an event handler

One risk we must handle during run sessions is exceptions, as they can have a fatal impact on the robustness of our automated tests. UFT provides the recovery scenario as a built-in solution (refer to Chapter 6, Event and Exception Handling), but it is quite complex to implement and may hinder the performance of the test.

In this recipe, we will see how to implement a simple recovery mechanism that is integrated with the controller (described previously) and that utilizes the same design pattern used for the regular actions to implement recovery procedures.

Getting ready

Add an Environment variable to the test. Name it ERR_DEFAULT and set its value to StopRunSession. Add another Environment variable named ERR_9 and set its ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.