Problem
While image matching is a powerful capability, it is not always the best tool for the job -- it can tie up a lot of computing resources, and sometimes preliminary work is needed to capture screenshots that will match reliably.
Solution
Image matching enables Cycle to interact with any desktop application for testing or process automation. Cycle uses an image-matching algorithm that enables reliable and smooth image matching, and this algorithm is constantly being improved. When possible, use keyboard shortcuts (hotkeys) instead of image matching, to maximize execution speed, reliability, and portability. Of course, hotkeys are not always available, and this is when image matching becomes invaluable.
Best practices
To get the best results with image matching in Cycle, follow these tips for any machine that will be running Cycle, including remote clients:
- When Cycle “clicks” on an image, it clicks on the center of the selected image. Crop images such as icons closely for better matching results.
- In general, image matching is significantly more reliable when all clients running Cycle use the same operating system and desktop theme. Desktop wallpapers should, ideally, be a solid color (as opposed to a striped gradient, for example).
- Windows clients should operate with a font size of "Smaller -- 100%", otherwise described as "96 DPI".
- Computer monitors should be set up to operate with 32-bit color depth for cleaner matching. This is particularly important if anything on the screen, such as web pages or software applications, are styled with a striped gradient color.
- Choose a standard screen resolution across all clients running Cycle. This is particularly helpful when testing applications or webpages with windows that may or may not scroll depending on the screen resolution.
- Consider setting up clients to operate software windows with a maximized viewport (e.g., fullscreen view), unless this is not supported by user behavior or standard workflow.
Additional considerations
Also remember these points when image matching in Cycle:
- By default, Cycle searches for images using approximately a 1:1 pixel match, but the image matching correlation can be adjusted to allow for more or less rigorous matching. To adjust the image matching correlation for one action only, choose an image Step that includes the correlation parameter. To adjust the image matching correlation for all Steps in a Feature File, go to the Settings screen in Cycle.
- Images must be in .PNG format, as this format is lossless, and enables image matching based on exactly what the user is seeing on the screen.
- The Image view can be toggled on or off via the Images On/Off button in the Cycle Ribbon.
- If you are experiencing issues using image and/or mouse Steps with a HiDPI display, try setting your screen resolution to
1600 x 900
or 1280 x 600
. The following Feature can be pasted into your Cycle to test this, if it does not result in the mouse moving in a square shape, you may want to consider running Cycle on with one of these suggested screen resolutions.
Feature: Move the mouse around
Scenario Outline: In a square
Given I move mouse to screen location <x> <y>
Then I wait 500 ms
Examples:
|x|y|
|500|500|
|570|500|
|570|570|
|500|570|
|500|500|