Modifying the property used to identify an object in a test script

When a test is recorded, the property that is used in the test to identify a graphic object might be inaccurate and cause the step to fail during playback. The generated property can be text or an image, depending on the application under test. With Rational Test Workbench, you can modify an object property and its value, as well as the operator, to improve test robustness.

About this task

This task applies to tests recorded from Android and iOS mobile apps and web UI apps (mobile and desktop web applications) with IBM Rational Test Workbench. You can also replace a generated text property with an image property to identify a target object. For details about object recognition in mobile and web UI tests, see Improving test script robustness.

Procedure

To modify an object property, you can use one of the following methods: drag and drop, copy and paste, or the context menu.

  1. Click a step in the script. The object captured during the recording of this test step is highlighted in the Mobile and Web UI Data view.
  2. In the Properties table of the Mobile and Web UI Data view, select a relevant property. Click the View main property only icon View main property only in the filter tool bar to see the main properties displayed in bold, or click the View verifiable property only icon View verifiable property only.
  3. Drag the property to the Object Identified by field in the test editor. Or, right-click the property in the table and select Copy, then Paste in the Object Identified by field. Another method is to right click a property in the table, and select Identify step target using property.

    A menu item is available for each candidate property in the context menu of the Screen Capture view (see Figure 2). If the newly selected property is inappropriate, a message warns you that object recognition may be broken. The property name and its value are replaced in the Object identified by fields.

    When the test is recorded, the default operator for identifying an object in a test run is ‘equals’ but there are many other operators that you can use to identify objects in a mobile or web UI application. They can be used for verification points in a test to verify an attribute, for example. See Creating verification points from the Mobile and Web UI Data view and Creating verification points in a test.

    Figure 1. Modifying the object property and value from the Properties context menu
    Here you modify an object property and value with the context menu 'Identify step target using property class'
    Figure 2. Modifying the property and value of an object captured during the test recording with a candidate property from the Screen Capture context menu
    Modifying the property generated for the object captured during recording with a candidate property from the screen capture's context menu
  4. Save and run the test to verify that the object is identified.

Feedback