Create Dynamic Variable

This is a pre-built Action located under the @Generic Element. The functionality of this Action in Avo Assure is to create a dynamic variable, assign a value based on the input provided. The execution result is stored in the given dynamic variable.

Syntax

Input Value: <variable name>;<value to be stored>

Note:

  • The variable you create appears within curly brackets {}.

  • A dynamic variable does not have a fixed value, and you can update it at any point during test execution using the Modify Variable Value action. To learn more about how to modify, click here.

  • The index starts at 0.

  • When you create a dynamic variable in a Test Step Group, you can use its value in any Test Case or Test Step Group within the same project.

  • You can access and reuse the created dynamic variable while building an end-to-end flow within the same project.

Argument
Description

<variable name>

(Required)

Provide the name of the variable you want to create.

<value to be stored>

(Required)

Provide the value that you want to store in the variable. Supported strings are:

  • Number

  • String

  • Alphanumeric

  • Special Characters

Output Value: <Dynamic Variable>(Optional);<Dynamic Variable>(Optional)

Argument
Description

<Dynamic Variable>(Optional);<Dynamic Variable>(Optional)

Both dynamic variables store the status as True or False.

Example 1: Creating a Dynamic Variable with a Specific Value

In this example, we explain how to create a dynamic variable and assign a value at runtime.

  • Action: Create Dynamic Variable

  • Input Value: {Username};Admin

    • The first argument ({Username}) specifies the name of the dynamic variable.

    • The second argument (Admin) specifies the value of the dynamic variable.

  • Output Value: {VariableStatus}

    • The execution status is stored in this {VariableStatus} dynamic variable with the following possible values:

      • True: If the variable is created successfully and the value is assigned.

      • False: If the operation fails due to an invalid variable name or missing value.

Note: If you do not define an output variable, Avo Assure displays the result only in the execution logs and does not store it in any variable.

  • Logical Explanation: The Create Dynamic Variable action fetches the value from the Input Value column ({Username};Admin). It creates a dynamic variable named {Username} and assigns the value (Admin) to it. This variable can be reused throughout the Test Case. The execution result is stored as (True) in the {VariableStatus} dynamic variable.

Example 2: Creating a Dynamic Variable Containing an Array and Accessing Its Values

In this example, we explain how to create a dynamic variable that stores an array and then retrieve a specific value from that array using its index.

  • Action: Create Dynamic Variable

  • Input Value: {Values};[12,34,23,45]

    • The first argument ({Values}) specifies the name of the dynamic variable.

    • The second argument ([12,34,23,45]) specifies the array value of the dynamic variable.

  • Output Value:

    • The execution status is stored in this {VariableStatus} dynamic variable with the following possible values:

      • True: If the array variable is created successfully.

      • False: If the operation fails due to an invalid variable name or incorrect array index.

Note: If you do not define an output variable, Avo Assure displays the result only in the execution logs (Avo Assure Client) and does not store it in any variable.

  • Using Array Index:

    • When the action creates the array, you access its values using index value as shown below.

      • {Values[0]} → stores 12

      • {Values[1]} → stores 34

      • {Values[2]} → stores 23

      • {Values[3]} → stores 45

  • Logical Explanation: The Create Dynamic Variable action takes the value from the Input Value column ({Values};[12,34,23,45]) and creates a dynamic variable named {Values} containing the array [12,34,23,45]. Each position in the array can be accessed using array indexing. The Display Variable Value action displays the value at the 2nd index of the dynamic variable by using {Values[2]} as input and shows the value as (23).

Knowledge Bites:

Here are some examples of different variable scenarios:

Variables
Input Value
Result

Text Variable

{String};AdminUser

AdminUser

Numeric Variable

{Number};35629

35629

Special Character Variable

Alphanumeric Variable

{Alphanumeric};OR1002

OR1002

List Values Variable

{Usernames};[John,Doe,Smith,Mac]

[John,Doe,Smith,Mac]

Last updated

Was this helpful?