As T-Plan Robot works on the desktop image level, image comparison is one of the key means of verifying behaviour of the tested application. The idea is that during test script design you save image templates of the tested application or its components for a reference. When the script is executed, the desktop image is compared to the template(s) to verify that it displays the expected result.
Version 2.2 supports four image comparison algorithms, tolerant image search, object search, Tesseract OCR and the legacy histogram based comparison method. All four methods will be discussed later on in separate topics with examples provided. As support of image comparison in T-Plan Robot Enterprise is an open framework, anyone is welcome to plug in third party algorithms and make them available to test scripts.
Image comparison may be invoked through one of the three
script commands (or their
corresponding methods in the
Java
Test
Script
API):
All commands accept the same set of image comparison parameters. T-Plan Robot Enterprise up to version 2.1 supports templates specified as a single image or a semicolon separated list of images. Version 2.2 introduces additional support of dynamic image collections represented by folders. As the test script refers to the collection by a simple folder name, this mechanism allows to add, remove and edit template images inside the image folder without having to update the test script code. When the script is executed, each collection is searched recursively for Java supported images of lossless format (PNG, BMP, WBMP, GIF) and the specified image comparison action is performed on the generated image list. Image collections may be of course freely combined into the old style semicolon separated file lists with single images or other image collections. See the image collection specification for examples.
Version 2.2 also creates
image meta
data for each newly created or updated template image. The meta
data file for example contains the original template image location on
the screen which allows the test scripts to test whether the component
has moved or not. Meta data also defines the best click point for the
eventual "find and click" type of tasks. The click point defaults to
the image center and may be customized in the GUI. For more information
see the
image
meta data specification.
The comparison is
considered to
pass when at least one template from the list produces a match. This
allows one graphical object to be represented by multiple images, for
example where one script is being executed against various environments
(operating systems) or when the verified component is known to changes
its state (appearance).
Default
location of template images in the file system is defined by the
_TEMPLATE_PATHvariable and defaults to the user home folder (configurable in the
Preferences->Scripting->Languagewindow). All template
images and collections specified in a relative way will be resolved
against this directory. To set the folder
to a custom location simply set the variable at the beginning of your
script using the
Var command. A favourite trick is to put images into the same folder as the
test script and set the template path to this location as follows. This
allows to create a relocatable test suite which is independent from any
fixed file paths:
Var_TEMPLATE_DIR=
"{_SCRIPT_DIR}"
The
following picture demonstrates the GUI representation of image
comparison parameters and their corresponding script commands on an
example of image collection with two template images of a button in
enabled and disabled state.
12 December 2014 |
Copyright © T-Plan Ltd. |
Version 1.0 |