Custom comparers for bitmap checkpoints
Relevant for: GUI tests and components
This chapter is intended for COM programmers who want to customize the algorithm used to compare bitmaps in bitmap checkpoints.
A custom comparer is a COM object that you develop to run the bitmap comparison in a bitmap checkpoint according to a specific algorithm. This enables you to create bitmap checkpoints that perform the comparison according to your needs.
By default, a bitmap checkpoint in compares the actual and expected bitmaps pixel by pixel and fails if there are any differences. You can use various bitmap checkpoint configuration options to refine the bitmap comparison and make it more flexible. For example, you can define tolerance levels, or you can specify not to compare complete images, but rather compare selected areas within them, or to locate a specific image within an object in your application.
If you need to further customize the way bitmaps are compared in checkpoints, you can develop custom comparers and install and register them on the OpenText Functional Testing computer. An OpenText Functional Testing user can then choose to use a custom comparer to perform the comparison in a bitmap checkpoint (on a per checkpoint basis).
The COM object that you develop must implement interfaces that OpenText Functional Testing provides in a type library, and register to the component category that OpenText Functional Testing defines for bitmap comparers. The type library (BitmapComparer.tlb) and the category ID (defined in ComponentCategory.h) are available in <Installdir>\dat\BitmapCPCustomization.
When an OpenText Functional Testing user creates or edits a bitmap checkpoint, any registered custom comparers are displayed in the advanced settings in the Bitmap Checkpoint Properties dialog box (in addition to the OpenText Functional Testing default comparer). The user can then select a comparer according to the testing requirements of the specific application or bitmap being tested. For more details about using custom comparers in OpenText Functional Testing, see Fine-tuning the bitmap comparison.
You can find an example of a situation where developing a custom comparer enhanced the use of bitmap checkpoints, in Custom comparer for images whose location changes - Use-case scenario.