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

Using a global dictionary for recovery


A powerful technique to implement the direct invocation of a recovery procedure makes an ingenious use of a global (public) Dictionary object. The method involves the use of command wrappers, function pointers, and callback functions. If you are not familiar with such object-oriented design patterns and concepts, then it is recommended that you first read Chapter 7, Using Classes, where some basic concepts are outlined.

The idea of using a dictionary to implement function pointers was first raised in an article published on www.advancedqtp.com/ back in 2007. A Dictionary object is capable of storing data of any type, including objects and even other Dictionary objects, thus serving as a tree-like structure. It occurred to us that we might exploit this idea to store executable objects, which would run their code upon accessing their associated (hashed) keys. An executable object in VBScript can be built using the command wrapper design pattern, which...