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

Registering a method to all classes


In some cases, we may need to customize a method that is common to all TO classes, or at least to all references to a particular environment, such as the Web or Java. For example, suppose we need to customize the Click method and register all Web TO classes. To write a statement for each class is quite tedious, and it may be an error-prone practice. For example:

RegisterUserFunc "WebEdit", "Click", "AQTP_Click"
RegisterUserFunc "WebButton", "Click", "AQTP_Click"
RegisterUserFunc "WebRadiobutton", "Click", "AQTP_Click"

If the new implemented method needs to be registered to all classes of all environments, then it becomes impractical and undesirable to maintain this via code. We can manage such custom function registrations better by using a data-driven approach.

Getting ready

You can use the FR_RegFunc.vbs function library as in the Overriding a Test Object method recipe.

How to do it...

Perform the following steps:

  1. In the function library, we will write the...