To be able to launch subsequent tests in the same logical flow (session) from the same
devices, you must select a variable including a reserved variable name and selection criteria
related to one or multiple devices.
Declaring a test variable is applicable to Android, iOS, hybrid and Web UI
applications.
-
In the Test Navigator, browse to the test and double-click
it.
The test opens.
-
To create a container
for the test variables that you create in a test:
-
Open the test, and in the Test Contents area,
click Test Variables, at the top of the test.
-
Select .
A container
named Test Variables is created for the user-defined
variables.
-
Select the container to rename it.
The Test Variables Details area opens for you to type a new name
in the Name field.
-
To declare a variable in a test:
-
Open a test and select the test variable node.
-
Click
-
Enter the name of the variable for the mobile device selection as
Mobile_Device_Selection.
The variable is automatically initialized to the name of the Android device or
emulator where the recording of test was performed.
-
Click OK. The variable is added as the last element in the
container and the Variable Details area opens.
-
In the Visible in section, select This test
only to restrict data to the current test only. Even if another test has
a variable with the same name, that variable will not change. Select All
tests for this user to share the value of this variable when the test
runs in a compound test. For the variable to be shared, both tests must have a
variable with the same name and must have this option enabled.
-
Assign a specific value to the variable and initialize
the variable:
-
Select Text
-
Enter a selection sentence to assign a variable value
to a text string. Enter selection strings including a devices
property, followed by an operator value, propertys value and
a comma separating each string. For more details on the main device
properties you can use and on the syntactic rules, see the Variable selection values topic.
The variable can then be initialized from some external source (a dataset, tests from an IBM® Engineering
Test Management test suite, or tests from the
same user in compound tests containing one or more mobile tests. It can also be set within a
tests execution with a variable assignment action from any data source, including a data
correlation reference, custom code, built-in function, dataset, or string constant. As a
result, successive tests in the same session will then be sure to run on the same actual
devices.
Note: When
a test launches an application:
- The Mobile_Device_Selection variable content is checked to get the device
ID
- The device is reused if it is still applicable to the app that
must be launched. Conditions:
- The device operating system must be the same as the operating
system of the application to be launched.
- The tester app is installed or can be installed without user intervention.