Create and use a global variable

When the TruClient Runtime Settings > Replay > Simulate a new user for 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:


    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