Develop a custom comparer

Relevant for: GUI tests and components

Tip: To practice performing this task, see Develop a custom comparer - Tutorial.

Prerequisites

  • Knowledge of image processing

  • Experience in developing COM objects

Back to top

Develop the custom comparer COM object

  1. Create the custom comparer COM object. You can use any language and development environment that supports creating COM objects.

    Note: Depending on the language that you use for development, you might be able to specify the custom comparer name when you create the COM object. Otherwise the name can be specified on the UFT One computer after registering the object. For details, see Set the Custom Comparer Name - Optional.

  2. Program your COM object to implement the custom comparer interfaces. For details, see Implement the bitmap comparer Interfaces.

Back to top

Prepare the custom comparer installation

Your custom comparer might need to be installed on more than one computer. You can create a program that automatically performs the steps necessary to install and register the comparer and its documentation on those computers.

For details on the steps that such a program needs to perform, see Install your custom comparer and register it to UFT One.

For example, when you design your custom comparer installation, you must ensure that when it is installed on the UFT One computer, it is also registered to the component category for UFT One bitmap comparers. This can be achieved in different ways, such as:

  • If you develop your custom comparer in C++ using Microsoft Visual Studio, you can modify the DllRegisterServer and DllUnregisterServer methods to handle this registration. These methods are called when you run a .dll using the regsvr32.exe program. You can see an example of this type of implementation in Develop a custom comparer - Tutorial.

  • If you develop your custom comparer in an environment that does not enable you to modify the registration methods, you can add an additional program that handles this registration and instruct users who install the custom comparer to run this program as well. You can see an example of this type of implementation in the Visual Basic sample custom comparer that UFT One provides. For more details, see Use the bitmap checkpoint custom comparer samples.

Back to top

Install the custom comparer

On the computer where you want to use the custom comparer, do one of the following:

Back to top

Test the custom comparer

Create bitmap checkpoint steps in a test or component in UFT One. In the Bitmap Checkpoint Properties dialog box, click Advanced settings, select your custom comparer, and use it to perform bitmap checkpoints and check that they perform correctly.

Tip: By default, UFT One displays expected, actual, and difference bitmaps in the run results only for checkpoints that fail. When you test your custom comparer on UFT One, you might want to see the expected, actual, and difference bitmaps in the run results even for bitmap checkpoints that pass. To configure this, select Tools > Options > GUI Testing tab > Screen Capture node in UFT One and set the Save still image captures to results option to Always.

Back to top