Create and use a global variable

When the TruClient General Settings > Local > Simulate a new user on each iteration is selected, variables are cleared between iterations. You can create a global variable whose scope exists between iterations.

  1. Add an Evaluate JavaScript step. In the Arguments sections add code to define the variable in the Init Block:

    For example, Global.Number=5:. The global prefix defines a global variable named number.

  1. After defining the variable, use it in the Run Block. For example, use the variable to control script flow:

Back to top