Defining a variable to run a test with a selected mobile device
To be able to launch subsequent tests in the same logical flow (session) from the same devices, you must define a variable including a reserved variable name and selection criteria related to one or multiple devices.
About this task
Procedure
-
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:
-
To define a variable in a test:
- Open a test and select the test variable node.
- Click
- Enter the name of the variable, which is a reserved name for this selection variable: RTW_Mobile_Device_Properties or RTW_Mobile_Selected_Device
- Click OK. The variable is added as the last element in the container and the Test Element 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.
Results
The variable can then be initialized from some external source (a dataset, tests from an IBM® Rational® Quality Manager 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 RTW_Mobile_Selected_Device 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.
- If the conditions are not matched, the content of the RTW_Mobile_Device_Properties variable is checked
- If this variable is set, the first device matching all the valid property expressions of the variable is selected
- If the variable is not set, the first applicable device ready
for test is used. 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.