Next Command


This command loads the next value from a list of values into variables.


Next listVariables;



A comma separated list of variable names into which the generated values are to be loaded.
The variables must have been declared with an associated list or range of values.


When the NEXT command is first executed, the first value from the value set will be retrieved and then each call to NEXT will retrieve the following value in the set. When the last value has been reached, the next value retrieved will be the first in the set.
The RESET command can be used to reset the value pointer associated with a variable so that the following NEXT command will retrieve the first value in the set.

When several SCRIPT or GLOBAL variables are dependent (eg: a LOGIN and its associated PASSWORD), the NEXT command should be called once with all those variables as parameters. Multiple calls to NEXT command for each variable should be avoided in order to keep the variables consistent.

A script can work fine with one virtual user but may behave strangely with 2 or more virtual users:

Example of an incorrectly written script:

string szLogin {"login1", "login2"} global;
string szPassword {"pwd1", "pwd2"} global;

Next szLogin;
Next szPassword;

for this script, the following scenario can happen:

The script should be written as shown below:

string szLogin {"login1", "login2"} global;
string szPassword {"pwd1", "pwd2"} global;

// Fill szLogin and szPassword simultaneously to avoid concurrent accesses from different virtual users
Next szLogin, szPassword;

// Another way to avoid concurrent accesses
lockmutex "MutexName";
Next szLogin;
Next szPassword;
unlockmutex "MutexName";


STRING Employee { "Devlin", "Reiser", "Niedringhaus", "Mason" } GLOBAL;
STRING Address { "3114 Pioneer Avenue", "1033 Whippany Road", "1990 Windsor Street", "550 Dundas Street East" } GLOBAL;

NEXT Employee, Address;
LOG "Employee = " + Employee, " + Address = " + Address;

NEXT Employee, Address;
LOG "Employee = " + Employee, " + Address = " + Address;


Employee = Devlin, Address = 3114 Pioneer Avenue
Employee = Reiser, Address = 1033 Whippany Road

Go back to the Learning center:

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