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
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
Procedure
To create a variable assignment and set it the value to a Mobile objects property:
- Open the test, and in the Test Contents area, select a test element.
- Select , which inserts the assignment before the selected element. The Test Editor window opens and lists the variables available to the test.
-
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.
-
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:
- 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.