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

Implementing a generic Login class


In this recipe, we will see how to implement a generic Login class. The class captures both, the GUI structure and the processes that are common to all applications with regard to their user access module. It is agnostic to the particular object classes, their technologies, and other identification properties. The class shown here implements the command wrapper design pattern, as it encapsulates a process (Login) with the main default method (Run).

Getting ready

You can use the same function library cls.Google.vbs as in the previous recipe Implementing a simple search class, or create a new one (for instance, cls.Login.vbs) and associate it with your test.

How to do it...

  1. In the function library, we will write the following code to define the class Login:

    Class Login
      Private m_wndContainer  'Such as a Browser, Window, SwfWindow
      Private m_wndLoginForm  'Such as a Page, Dialog, SwfWindow
      Private m_txtUsername  'Such as a WebEdit, WinEdit, SwfEdit
      Private...