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, which means identifying controls by one or more screenshots of specific areas in your application.
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 Identify by > Image from the ribbon menu.
-
In the Identify By Image pane, select the + icon to add an identifier.
-
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 at runtime:
-
Fullscreen: always search the entire screen.
-
Controlbased: only search the vicinity of the control.
-
Auto: leave the decision up to Tosca Cloud.
-
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.