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

Verifying binary file contents (FileCompare)


UFT offers a file-comparison utility that can be used as a COM object; exactly like the DeviceReplay, as we have seen earlier in this chapter. This utility is extremely useful to compare pictures and other files storing binary data, by means of calling its IsEqualBin method, the syntax being as follows:

obj.IsEqualBin FilePathname1, FilePathname2, plErrorCode As tagCompError, [pFlags As Long]

Where obj is an instance of Mercury.FileCompare, and plErrorCode with value 0 (FC_NO_ERROR) indicates an in file compare class showing no error, and pFlags is an optional argument, which, with value 1 (FC_DIFF_SIZE), indicates an in file compare class showing difference of size.

Getting ready

From the File menu, navigate to New | Test, or use the Ctrl + N shortcut.

How to do it...

Write the following code in Action of your test:

Dim FileComparisonUtil

Set FileComparisonUtil = CreateObject("Mercury.FileCompare")

'Compare two binary files (e.g., pictures)
Print...