Assigning a test variable to an objects property

You can assign a new value to a test variable and set it to a Mobile objects property.

Before you begin

To be able to create a variable assignment, you must first declare a variable. This task is explained in the Declaring and assigning test variables page. Then you can set a value for the objects property, it will be used when the variable will be executed in the test.
You can create variable assignments in all tests that are created from Android, iOS, hybrid or Web UI applications.
Note: When you run a test from the mobile client on mobile devices, it uses the same values that you used during recording. If you modify the test script and create a dataset or variable, or if you add a condition, a loop, custom code, references or add other statements, they are not taken into account by the mobile client at run time. To verify that the initial recorded values are substituted with variable data, you must initiate the test run from Rational® Functional Tester.

About this task

This action is applicable to tests created from Android, iOS, hybrid or native mobile applications.

Procedure

To create a variable assignment and set it the value to a Mobile objects property:
  1. Open the test, and in the Test Contents area, select a test element.
  2. Select Insert > Variable Assignment, which inserts the assignment before the selected element. The Test Editor window opens and lists the variables available to the test.
  3. Select the variable that you are assigning a value to, and, in the Set to box in the Test Element Details area, select UI object property, set the value for the variable to Mobile objects property. Select a graphic object and the objects property.
    The values of the properties are different for web, Android and iOS apps.
  4. Save the test.
    A set statement is added to the test, with the value you chose.
The other way is to assign a variable to an object select in the Data Mobile view but the variable must be created before:
  1. In the SmartShot View view, from the SmartShot tab or the Elements tab, right-click an object and select Create variable assignment from the element selected. In the wizard that opens, select a variable and click OK. The variable is added to the test suite.