What is variable scope in ScenarioBuilder?

Variable scope property allows you to provide levels of access to the variables. There are 3 options of variable scope that you can select:

  • Global - The value of the variable will be accessible during all iterations of the scenario execution (useful in ScenarioBuilder, AppLoader and AppVerify).
  • Script - This is the normal scope where the variable will be accessible during one iteration. The value of the variable is accessible from sub-scenarios as well.
  • Internal - This option is to make the variable internal to the script and not used in AppVerify (useful in AppVerify).

Here is an example of how to use the Global scope.

In this scenario, we want to play a scenario multiple iterations and we want to know the time that the first iteration started.

We have added an If statement to check if the current iteration is 1, then we've set a global variable named StartTime.

For the rest of the scenario, we will be able to print the value of StartTime and this same value will also be accessible in the rest of the iterations.

Screenshot_1