Values for device selection variables
You can create a variable using one of the following reserved names:RTW_Mobile_Device_Properties or RTW_Mobile_Selected_Device. The variable will be used to enable the selection of a device in your tests. In your variable, you must enter strings that include the device’s properties and the associated values, and the strings must comply with the syntactic rules detailed in this topic.
Name
- RTW_Mobile_Device_Properties: This variable must contain a valid selection sentence.
- RTW_Mobile_Selected_Device: This variable contains, by default, the ID property of the previously selected device for the current virtual user. It can also be set up explicitly by the end-user with the ID property of the selected device.
Initialize to text
To initialize the variable to a specific value, enter one or multiple selection strings in the Text field. The strings consists of the following items: property’s name followed by operator value followed by property’s value,. The strings are separated with commas. Example: type = Android.
- Device properties
Table 1. Main device properties list of the main properties for a selected device
Key Content (value) type Type iOS or Android description A string containing the device model and its brand apilevel Starting from 8 for Android and 60000 for iOS (60000 is for 6.0, 60100 is for 6.1) width Width of the screen in pixels height Height of the screen in pixels locale Configured locale (language or country code) simulator True for an emulator or simulator, false for a real device landscape True if the device is landscape oriented, otherwise false (example: portrait oriented) gps True if GPS is available and active, otherwise false phone True if phone is available, otherwise false bluetooth True if Bluetooth is available and active, otherwise false id This is a unique identifier generated for a device. It is displayed in the device category of detailed properties of the Mobile Device editor. It must be used in the RTW_Mobile_Selected_Device variable. Other properties can be used. They are displayed in the Mobile Device editor.
- Syntactic rules
sentence: property-expr { , property-expr }* property-expr: property-name operator value operator: = | != | < | > | <= | >= | : | =* | !=* value: boolean | decimal-number | word | quoted-string boolean: true | false integer: optional-minus-sign [digit]+ floating-number: optional-minus-sign [digit]+.[digit]+ word: [A-Za-z$_][A-Za-z$_0-9]* quoted-string: 'any-char-1' | "any-char-2"
Where:- property-expr must be set to allow a device selection
- property-name corresponds to a property listed above in the table of main properties, or to other advanced properties (see the detailed properties section in the Mobile Device editor).
- The = and != operators are valid for Boolean properties.
- The =, !=, <, >, <= and >= operators are valid for numeric and lexicographical properties. They are not case sensitive.
- The: operator is used to check the lexicographical content of the value entered for the device's property in the selection string. The value is case sensitive
- The =* and !=* operators are used to check whether the value entered for the device's property in the selection string is interpreted as a regular expression.
- Two kinds of quoted strings depend on their enclosing character ' or ". They are used for a string value containing more than one word or containing special characters, such as regular expressions
- ’any-char-1’: you can enter all kinds of characters in single-quoted literals, and the ' character must be doubled. Example: It"s "John", which results in: It’s ’John’.
- 'any-char-2': you can enter all kind of characters after a double-quoted literals, but it must be followed by a backslash. Example: "weird\"content\\with-special'chars" which gives: weird"content\with-special'chars
- Prefer single-quoted literals for regular expressions because they do not require adding other backslashes.
- The accepted regular expressions are the ones defined in the documentation of Pattern class, Java 6.