Configure test variables
To enhance the effectiveness, flexibility, and maintainability of your tests, you can use test variables. Variables allow you to store and reuse values across multiple test cases or test steps. They also make it easy to change input data or expected values without modifying the entire test. This is helpful when you need to run the same test with different inputs or adapt tests to changing application features or test senarios.
As your test suite grows, variables also help you maintain consistency, which is important for scalability.
Each test variable consists of the following attributes:
- Name: Any string that contains letters, numbers, and the underscore character '_' . It cannot begin with a number.
-
Type: Test variable types are: Boolean, DataTable, Device, Number, Media, Secured String, and String.
- Value: Depends on the selected variable type. For example, if Type = Device, the value will be set using the Select Device dialog box and if Type = Media, the value is selected from the repository or the local computer.
By default, a DUT (Device Under Test) variable is available for every test. A DUT variable is essential to execute a test. By default, the DUT variable selects the opened device as its value. You can select a device as a value for the variable.
To learn how to configure test variables in Scriptless Mobile, watch this video or review the instructions following the video.
-
On the top toolbar, click the Configure test variables button .
- In the Configure test variables dialog box, click Add New Variable.
- Select the type of variable.
- Enter the name of the variable.
- Enter a value for the variable.
-
Click APPLY.
-
In the Configure test variables dialog box, click Add New Variable.
-
Select the type of variable as Secured string.
-
Enter the name of the variable.
-
Enter a value for the variable.
-
To secure the variable value, click the encryption button .
-
(Optional) To copy the encrypted value to clipboard, click .
-
In the Configure test variables dialog box, click Add New Variable.
-
Select the type of variable as Media.
-
Enter the name of the variable.
-
In the Value column, click the Select media link.
-
In the dialog box that opens, select the location of your app file: Repository (default) or Computer.
-
Depending on your selection in step 5, do the following:
-
Repository: Search for and select the repository file you want to use and then click SELECT.
Tip: You can search by tag name, if applicable. If a file is associated with tags, a tag symbol appears below the file name, along with the number of tags associated with the file. To view the tag names, move the pointer over the tag icon .
-
Computer:
-
Click ADD MEDIA FILE.
-
Browse to the file you want to use.
-
Select the file and click Open.
-
Click SELECT.
-
-
-
Click APPLY.
-
In the Configure test variables dialog box, click Add New Variable.
-
Select the type of variable as DataTable.
-
Enter the name of the variable.
-
In the Value column, click the Select DataTable link.
-
In the dialog box that opens, expand the folders and select the desired DataTable.
-
Click LOAD.
-
Click APPLY.
-
In the Configure test variables dialog box, hover over the variable to be modified and select the Type.
-
In the Replace variable type dialog box, click YES to confirm your change.
-
Change the name and/or value of the variable.
-
Click APPLY.