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

Building a test reporter


We have seen in the previous recipe that Action can accumulate data by adding information to its Details field. The Status field of Action is set from within the code, generally the Run method. Our reporting mechanism leverages the fact that the Actions are objects, and that they will use the native UFT reporter as their target output.

Getting ready

From the File menu, navigate to New | Function Library, or use the Alt + Shift + N shortcut. Save the file as C:\Automation\Lib\lib.Reporter.vbs.

How to do it...

Write the following code in the function library you created:

Function ReportActionStatus(ByRef p)
    ' --------------------------------------------------
    ' Function    :    ReportActionStatus
    ' Purpose    :    Reports an event to the UFT reporter with the data of the referenced Action
    ' Args        :    ByRef p
    ' Returns    :    N/A
    ' --------------------------------------------------
    Reporter.ReportEvent GetNormalizedStatus(p.Status.Value...