You can assign a new value to a test variable and set it
to a Mobile object’s 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 object’s 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 datapool 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
the workbench.
About this task
This action is applicable to tests created from Android,
iOS, hybrid or Web UI applications.
Procedure
To create a variable assignment and set it the value
to a Mobile object’s 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 Mobile and Web
UI object property, set the value for the variable to
Mobile object’s property. Select a graphic object and the object’s
property. The values of the properties are different for
Web UI, 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 Mobile and Web UI Data view,
from the Screen Capture 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.