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

Preface

Unlock the full potential of Unified Functional Testing (UFT) 12 with the introduction of new features and functionality. Learn the industry's best kept secrets, enhancing toolset capabilities like you never thought possible. Whether you are a casual user of UFT or an advanced power user searching for new automation design patterns to supercharge your existing framework, look no further as this is the book for you.

Join the authors who, with three decades of automation expertise between them, are ready to share with you ways to make your tests more relevant, effective, maintainable, efficient, manageable, portable, and reliable. This book is designed to be an invaluable source of reference for everyone with its clear and powerful coding examples. Why waste any more time trying to reinvent the wheel? Instead, accelerate straight to the expert level in UFT today!

What this book covers

Chapter 1, Data-driven Tests, covers the design patterns required to truly unlock the DataTable functionalities (create, retrieve, store, import, and export).

Chapter 2, Testing Web Pages, covers the design patterns required to manage modern-day browser capabilities and the challenges: handling broken links, websites' downtime, multiple browser instances, cookies, unexpected pop-ups, downloading and uploading files, synchronization, and most importantly, object identification and checking dynamic content through the DOM.

Chapter 3, Testing XML and Database, covers the design patterns required to manage DB connections, executing SQL statements, and a walkthrough of advanced DB and XML checkpoints.

Chapter 4, Method Overriding, covers the design patterns required to override a Test Object method, enriching basic functions, and adding exception handling mechanisms.

Chapter 5, Object Identification, covers the design patterns required to effectively manage the object identification process through techniques such as Inline Descriptive Programming, Description Object, ChildObjects, and native properties.

Chapter 6, Event and Exception Handling, covers the design patterns required to provide robust and maintainable tests that can deal with unexpected events or exceptions by catching errors inside a function or subroutine, recovery scenarios, and how to use the global dictionary for recovery.

Chapter 7, Using Classes, covers the design patterns required to implement classes in VBScript, along with illustrative examples and implementing function pointers.

Chapter 8, Utility and Reserved Objects, covers the design patterns required to utilize advanced functionality hidden within the depths of UFT.

Chapter 9, Windows Script Host, covers the design patterns surrounding the underlying infrastructure provided by the platform to execute scripts written in a variety of programming languages.

Chapter 10, Frameworks, covers the design patterns to implement modern-day test automation frameworks exploring modular-driven, data-driven, keyword-driven, model-driven, and hybrid techniques to find the best approach that works for you.

Appendix, Design Patterns, covers the additional design patterns, including auxiliary classes and functions, to enhance the tool set capabilities and unlock the full potential of UFT. It provides powerful examples for both the action and runtime data patterns to put into practice what has been covered in the previous chapters.

What you will need for this book

The only prerequisite for this book is that you need the latest version of HP's UFT installed. This can be downloaded directly from the HP enterprise website:

http://www8.hp.com/uk/en/software-solutions/unified-functional-testing-automation/

The example code design patterns snippets are for reference only and need to be adapted to become context-driven.

To add example code files to the UFT solution:

  1. From the project navigate to File | Settings.

  2. Click on the Resources section.

  3. Click on the + button, then the ellipses button on the far right to browse to the location where the function library is located.

  4. Navigate to the location of the example code file and click on Open to associate to the project resources.

  5. Then a pop-up message will present itself with Automatic Relative Path Conversion at which point you can decide to use a Absolute Path or Relative Path.

Alternatively, right-click on the test project and navigate to Add | Associate Function Library to fast track the above process.

Who this book is for

This book is designed to be an invaluable source of reference for end users of HP's UFT.

Depending on your exposure level to coding with VBScript, you may require assistance with some of the more advanced design patterns.

Sections

Each chapter contains sections using the following structure:

Getting ready

This section tells us what to expect in the recipe and describes how to set up any software or any preliminary settings needed for the recipe.

How to do it…

This section characterizes the steps to be followed for "cooking" the recipe.

How it works…

This section usually consists of a brief and detailed explanation of what happened in the previous section.

There's more…

It consists of additional information about the recipe in order to make the reader more confident about using the recipe.

See also

This section will, where needed, contain additional references to the recipe.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We will retrieve the value of a DataTable parameter, namely, LocalParam1, from the Action1 local sheet with the following code written in the code editor inside Action1"

A block of code is set as follows:

Dim MyLocalParam

MyLocalParam = DataTable.Value("LocalParam1", dtLocalSheet)
Print MyLocalParam

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Leave all the fields with the default values and click on OK."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.