Control identification methods

Your application has various screen elements, such as buttons, text boxes, menus, tables, and so on. These elements are called controls. At runtime, Tosca Cloud tries to find these controls and interact with them, so you can be sure that your application works as expected.

To make this possible, you must first scan your application. This gets the necessary technical data into Tosca Cloud. During the scan, each control receives identifiers—and you can also choose your own. Tosca Cloud then uses these identifiers to find your controls during test execution.

Golden rules for identifiers

Let's start with the most important facts. No matter what you choose, all identifiers must meet these criteria:

  • They're unique to the control. If they aren't, Tosca Cloud can't find the right control at runtime, let alone interact with it.

  • They're stable. If they aren't, Tosca Cloud might find the control, but not in every test run. In the worst-case scenario, the identifier only works once, during the scan. For example, if you have session-based information in properties. All in all, unstable controls result in unstable tests and inconclusive results.

Identification methods

Tosca Cloud offers different ways to identify controls:

  • By property, where you identify a control by its technical properties in the application code. Typically, properties are the fastest and easiest way to identify controls. We recommend that you always try this method first. Identification by property is the default method in Tosca XScan, and it's the only method in Cloud Scanner.

  • By index, where you identify a control by its position in the index of a page. It's a good solution for controls that exist in multiple places on the same screen. This option is only available in Tosca XScan.

  • By image, where you identify a control by one or more screenshots. We recommend this method for controls where nothing else works. This option is only available in Tosca XScan.

  • By anchor, where you identify a control by its location relative to other controls ("anchors"). This method might work for some use cases, but overall, we advise against using anchors for web applications. In a modern web context, it's typically too difficult to find anchors that are consistently stable. This option is only available in Tosca XScan.