Image Difference ("diff")
4.4.2 Image Difference ("diff")
DESCRIPTION
The Image Difference (code "diff") compares the desktop screen against one or more full-screen template image(s) and produces a set of differences. It is typically used with the Screenshot command to insert an image with the highlighted differences into the Report (see Examples below). The algorithm is edge-based and omits colour changes.
OPTIONS
The method requires one or more full-screen size template images and/or image collections specified through the hosting command or Java method call. The parameter of "passrate" defines the lowest acceptable level of difference to produce a PASS result. It defaults to 95%.
The "cmparea" is optional and defaults to the full screen when omitted. No other method-specific parameters are supported.
RETURNS
The method makes the calling command (method call) return 0 (success) if the produced comparison result is greater than or equal to the specified pass rate. Otherwise, it returns the value of 1.
EXAMPLES
Compareto myscreen.png method="diff" passrate="98"
if ({_EXIT_CODE} > 0) {
Exit 1
}
- Exit the script if the screen differs from the myscreen.png one more than by 2%.
Screenshot myapp.png template="expected_screen.png" passrate="95" method="diff" drawdiff="true"
- Draw differences between the desktop screen and the expected_screen.png image into a screenshot in the report file.