Variable Scope Options

Description:

The variable scope options define how widely accessible the variable is; they are mutually exclusive. The variable scope options are: LOCAL, USER, SCRIPT and GLOBAL.

Local Scope Variables

Local scope variables are only accessible to the Virtual User running the Script in which they are defined. They cannot be accessed by any other Virtual Users or Scripts. Similarly, a Script cannot access any of the local variables defined within any of the Scripts it calls.

A Local scope variable can only be used by Virtual User 1 in Script 1, Virtual User 1 in Script 2, Virtual User 2 in Script 1, etc. Each Virtual Users copy of the variable can only be referenced and used by them.

Script Scope Variables

Script scope variables can be accessed by any Virtual User running the Script in which they are defined.

A Script scope variable can be used by Virtual Users 1 to 4 in Script 1 or by Virtual Users 1 to 4 in Script 2, etc. There is only one copy of the variable which can be shared by any user. It can only be referenced and used within the Script that it is defined.

User Scope Variables

User scope variables are accessible from any Script run by the Virtual User that defines them.

A User scope variable can be used by Virtual User 1 in Scripts 1-4, Virtual User 2 in Scripts 1-4, etc. Each Virtual User has their own copy of the variable which cannot be referenced or used by another Virtual User. A User scope variable must be defined in every Script in the sequence that uses it. Alternatively, define a user scope variable in the Global_Variables.INC file to include it in every Script.

Global Scope Variables

Global scope variables are accessible to any Virtual user running any Script.

A Global scope variable can be used by any Virtual User in any Script. However, it must be defined in each Script it is to be used in or included in the Global_Variables.INC file.

 

See also:

 





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap