Skip to main content
No Result Found

Variables

Minimize hardcoding to reuse test data across multiple steps

Variables are useful when a value input during test recording needs to be reused later within the same test. It helps in:

  • Eliminating hardcoded values
  • Maintaining tests easily. You can update the variable at one place rather than modifying it across multiple test steps.
  • Making tests more readable and self-explanatory by assigning meaningful names.

When to use variables?

  1. Use variables when dealing with repeated static values across different steps within a test. For example:
    • Validate full name or email in accounts profile section after logging in
    • Validate pricing details on checkout page after selecting a particular plan
  2. When the test requires dynamic input that may change during each test run which has to be consumed at a later point in the test.

  3. Use variables to centralize and manage data to make tests easier to update and maintain.

How to create and use a variable?

There are four ways to create variables:

  • Define static variables for test steps: Create a variable at any step where you have to input values.
  • Extract value from website dynamically: Capture dynamic values from website UI and store them as variables for later use.
  • Create variables using Custom JS script: Use javascript snippet to create variable from more advanced workflows. Learn more.
  • Extract value from API response: Store the response details from API step into a variable for later use. Learn more.

You can reuse these variables anytime you need to input values or perform text validation.

Define variables for test steps

  1. Navigate to the step where you have an input value which has to be reused.
  2. Click on the step name or the “>” icon to open the step configuration details.
  3. Click on “Convert to variable” below the text input. Convert variable
  4. Give a unique meaningful name to the variable and save it. Save variable

Extract value from website dynamically

In test automation, there could be scenarios where you would want to store some text content on the UI which dynamically changes into a variable. The Extract Value feature lets you capture these dynamic values from screen elements, store them as variables and reuse them in your test. For example, you can capture the price_of_product and store it in a variable to validate in checkout page if the total cost equals price_of_product * quantity. Since the price_of_product may change, extract value lets you use the updated values for a reliable test execution.

Perform the following steps to capture dynamic values from screen elements during test execution:

  1. In the recorder, click the Ellipsis icon and select Extract Value.
  2. Hover over the screen and select the element to create variable.
  3. Assign a name to the variable and click Create.

Extract variable

Importing a variable

  1. Navigate to the step where you want to reuse the variable created.
  2. Click on the step name or the “>” icon to open the step configuration details.
  3. Click on “+” and select “Import a variable” if the step is an input step or click “{}” icon besides the text input if the step is a text validation step.
    • Import variable in Input step Import variable in input step
    • Import variable in Text validation step Import variable in text validation
  4. Select the relevant variable you want to import. Select variable

Managing a variable

  • Managing a variable is possible at any step where the variable is in use. You can navigate to the step configuration details and edit the variable to any value of your choice. Editing variable from a step

  • Additionally, Low Code Automation also allows you to manage your variables from a single configuration page where you can edit any variable value and delete any variable that is not in use. Click on the “” icon to access the page. Manage variable from test configuration

Note:
  1. A variable can only be deleted when it is not used in any other steps.
  2. A variable can not have a variable within it.

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