Identify controls by image
To create stable, conclusive tests, you need to make sure that Tosca Cloud can reliably identify and interact with screen elements in your application ("controls").
There are different ways to identify controls. This topic takes you through identifying controls by image. This identification method pairs a control with one or more identifier images that Tosca Cloud uses to find the control during test runs.
Access this option
The option to identify controls by image is only available in the Advanced View of Tosca XScan.
Use this option
To identify a control by image in the Advanced View, follow these steps:
-
Select the control you want to identify in the tree view of the scan. Then, select ADVANCED IDENTIFICATION > IMAGE in the Identification methods pane.
-
In the Identifying Images pane, select the
add image icon.
-
Use your mouse to capture a screenshot of the identifier in your application.
-
Optionally, configure the Search Properties for this particular identifier:
Search property
Description
Accuracy
Define how closely (in percent) an identifier must match its screenshot during the test run. The lower the value, the less closely they must match.
Method
Define where Tosca Cloud should look for the identifier during test runs:
-
Fullscreen: always search the entire screen.
-
Controlbased: only search the vicinity of the control.
-
Auto: leave the decision up to Tosca Cloud.
-
-
Make sure your identifier is visible on your screen, so that Tosca XScan can run its uniqueness check on it.
-
If you need to identify multiple controls by image for the same module, try to have all identifiers visible on the screen for the uniqueness check. if that's not possible let Tosca XScan run the uniqueness check on each control individually.
You can create the module regardless of the outcome of the uniqueness check. Note that if an identifier isn't unique, Tosca Cloud won't reliably find it during test runs.
Considerations
When it comes to identifying controls by image, keep these things in mind:
-
The state of your implementation. How much change do you still expect in your application? If there are major design changes after the scan, Tosca Cloud will have trouble finding a match for the screenshot.
-
The screen resolution, color depth, or scrolling. Make sure that the user who scans the application has the same settings as the machine that runs your tests.
-
The number of screenshots you need to reliably identify a control. Controls don't always look the same. For example, you might have text boxes with changing content or toggle buttons with a different look in ON and OFF mode. Use more than one screenshot per control. For example, add a screenshot of an input field's label, or take screenshots of a toggle button in ON and in OFF mode.
-
The test execution time. At runtime, Tosca Cloud searches for a match for the first screenshot. If Tosca Cloud can't find a match, it moves on to the next screenshot, then the next, and so on. In other words, each additional screenshot increases test execution time. Limit the number of screenshots per control to what's absolutely necessary for identification.
What's next
Identification by image not working for what you need? No problem—try properties, index, or anchor.
However, if you're happy with your module, then it's time to start creating tests.