Skip to main content

Share test data

Learn how to share data across tests using variables in Low Code Automation.

Low Code Automation lets you share data across different tests within a test suite. When you define a variable in one test (parent test), its value can be used by other tests (child tests) within the same suite. This is helpful when data generated in one test needs to be validated or serve as input in other tests.

A parent test is the main test where you define the data (such as variables), while a child test is a dependent test that uses the data from the parent test for further validation or actions.

For example, when you create an order in Test 1 (parent test), an OrderID is generated. Instead of generating a new OrderID in every test, you can save it as a variable. In Test 2 (child test), you can use the same OrderID to check if the order is in a Shipped or Processing state. This way, you avoid recreating the order ID each time.

The following is a workflow to share data from a parent test to a child test.

Create a parent test

In Test 1 (Place an Order), you go to the store’s website, add items to cart, and place an order. Once the order is placed, you extract the Order ID value and save it as a variable to use it in the Test 2. For more information on how to extract the Order ID value, refer to the Extract Value document.

Extract Order ID

Share data in child test

You can now pass the Order ID variable from Test 1 to Test 2. While recording Test 2 (Validate Order), go to the order list and use the shared variable Order ID to validate the text.

  1. Click Text Validation and click the order ID you need to validate.
  2. Click the + icon under Expected Value and click Import a variable.
  3. In the Import variables dialog, select Other tests. It lists all the variables from other tests.
  4. Use the search bar to find the variable and select the desired variable from the list. The Set default value for local runs dialog appears. The default value you enter will be used only in local runs, while the cloud run will use the variable set in the parent test.
  5. Enter the default value and click Import. It displays values for both cloud and local runs.
  6. Click Save recording.

Similarly, you can also import variables into custom JavaScript. Open the custom action page, click + Import variables. You can also click Copy test ID to copy the test ID where the variable is used. The variable format for other tests is variables.test['test_id']['name'], where test_id refers to the test’s ID and name represents the variable’s name.

Test execution with shared data

To run a cloud execution with shared data, ensure that Test 1 and Test 2 are in the same test suite. Since Test 1 and Test 2 share data, it’s important to run them in the correct sequence, as the order impacts how and when the data is passed in the cloud run. For more information, see the Reorder tests in a suite section.

Here is a successful execution of the “Placed an Order” test, followed by the “Validate Order” test using shared data.

Successful execution with shared data

Manage shared variables

To view, edit, or delete a shared variable:

In Low Code Automation, go to Tests, select either the parent or child test, and click Configurations. Under the Advanced section, you’ll see the Variables section. It lists all the variables.

For parent test:

  • In the USED IN column, you’ll see how many steps and tests (child tests) the variable is used in. For instance, it could show as 2 steps, 2 tests, 2 modules, etc. Hovering over displays more detailed information about each step where the variable is used, including a list of all child tests where the variable is passed.
  • You can only remove the variable from the parent test if it is also removed from the child test.
  • You cannot delete a parent test if its variables are being shared in other tests. View steps and tests where the shared data is being used

For child test:

  • A shared variable is represented by a shared icon.
  • You can only edit the default value for local runs.
  • To remove the variable, you need to remove the reference from the respective step in the test. Edit shared variable value for local runs

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle