Create embedded tests
You can embed any test in another test. Such tests are called embedded tests. This way, you can reuse certain test steps in multiple tests, and when you need to make changes, it's sufficient to update the embedded test, and the changes will be available everywhere that test is used.
The Embeddable Tests sidebar displays all tests available in the repository.
You can embed a test from the Embeddable Tests sidebar to an existing test in the test editor.
The search field provides a way to find a specific test.
You can use the Collapse All option to collapse all folders.
Watch this short video to see how to work with embedded tests. Detailed steps follow.
You can add or embed a test to an existing test.
-
In the test editor, open a test into which you want to embed another test.
-
On the Embeddable Tests sidebar, double-click or drag the test to be embedded to the desired location in the test that is opened in the test editor.
You can view the content of an embedded test that is collapsed by expanding it. The name of the embedded test is visible in the test editor and displays an expand button
next to it.
-
In the test editor, click the expand button
next to the embedded test.
In a test, you can view the source location of an embedded test.
-
In the test editor, hover over the embedded test to view a tooltip with the name of the embedded test and its location.
You can move an embedded test to some other location within a test.
-
In the test editor, drag the embedded test to the required location.
Scriptless Mobile indicates the status of the runtime parameters of an embedded test as follows:
-
An error icon
appears if there are no or some mandatory runtime parameters. -
An orange icon
appears if the test has default parameters.
To run the test, you must configure all required parameters. You can keep the default values (where applicable) or add specific values as per your requirements, as follows:
-
In the test editor, select the embedded test.
-
In the command pane below the test editor, add or select values for the available parameters.
-
To specify how you want to run the embedded test, select the Script execution mode parameter and set the relevant value.
The available modes are:
-
Embedded (default): Runs the embedded test as part of the parent test. The parent waits for the embedded test to complete. A single report is generated that includes the embedded test details.
-
Sync: Runs the embedded test as part of the parent test, with the parent waiting for completion. A separate report is generated for the embedded test, making it easier to view individual results.
-
Async: Runs the embedded test independently. The parent does not wait for completion. A separate report is generated, and the parent report includes a link to the embedded test report.
-
-
(Optional) To add a comment to the test, select the Comment parameter and enter the comment in the Value field.
-
To modify the behavior when the embedded test fails to run, change the value of the On-fail Result parameter. The default is Continue.
To edit an embedded test, you must open it individually in the test editor.
-
On the top toolbar, click the File icon
and select Open. -
In the Open Test dialog box, navigate to the desired test location and select the test.
-
Click OPEN.
Before running an embedded test, make sure that you have selected the execution mode as per your requirement.
-
Navigate to the required test tab.
-
On the top toolbar, click Run test.
-
In the Enter runtime values dialog box, click Select device.
A DUT variable is essential to execute a test. By default, the DUT variable selects the opened device as its value. You can select another device as a value for the variable.
-
In the Select device dialog box, select a device and click SELECT.
-
Back in the Enter runtime values dialog box, click RUN
Select the View report link to view a detailed report of the test run. For more information, see Single test report (execution report).
-
You can return a value from the embedded test back to the main test using the Exit command in the embedded test.
The Exit command's Return value parameter accepts the value from the embedded test and further processes it as the result variable of the main test.
Perform the following setup steps:
-
In a text editor, open the embedded test.
-
Drag the Exit command to the end of the test.
-
Select the Exit command.
-
In the command pane, select the Return value parameter. This parameter stores the value of the embedded test 's execution result.
-
Select the Usage for the parameter.
-
Enter a value for the parameter.
In the main test, you can add or select values for the Result variable parameters, as follows:
-
In the text editor, open the main test.
-
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 as String.
-
Enter the Name of the variable.
-
Click APPLY.
-
-
Select the embedded test.
-
In the command pane at the bottom:
-
Select the Script execution mode as Embedded. In this mode, Scriptless runs the embedded test as part of the parent test. The parent waits for the embedded test to complete. A single report is generated that includes the embedded test details.
-
For the Result variable value, enter the name of the variable created in step 2.
-
-
On the top toolbar, click Run test. For detailed steps, see To run an embedded test.
Select the View report link to view a detailed report of the execution. For more information, see Single test report (execution report). The Report Details show the result variable value derived from the embedded test.