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 method overriding to support object subtypes


In some cases, we may need to implement different versions of the same native method to reflect different subtypes of a particular control class. To achieve this, we can use method overriding with RegisterUserFunc and reroute our test flow dynamically. For example, suppose that Application Under Test (AUT) uses different types of input controls, such as a password (encrypted) field, specially formatted fields for ID, date, and email, or even just for text, as opposed to numeric only data. In such cases, we might wish to use specific code to validate the input data or even (in a very advanced implementation) to generate it randomly.

Let us take, for example, two input fields (WebEdit) having different class HTML native attributes. We will write a custom version of the WebEdit_Set method (actually a delegate) that will reroute the function to execute a specific piece of code for the given element class.

Getting ready

From the File menu, navigate...