VariableManager Class

Manages NeoLoad variables.

There are several types of NeoLoad variables:

The Variable Manager allows you to:

Synopsis

 public class VariableManager {
  // Public Methods
  public boolean addSharedValue(String variableName,
                                String value);
  public void changeValue(String variableName);
  public boolean createSharedQueue(String variableName,
                                   int queueSize,
                                   int timeout);
  public boolean createSharedQueue(String variableName,
                                   int queueSize,
                                   int timeout,
                                   String filename,
                                   char delimiter,
                                   boolean swapLoaded,
                                   boolean swapDumped);
  public int getSharedQueueSize(String variableName);
  public String getValue(String variableName);
  public String parseString(String text);
  public String peekSharedValue(String variableName);
  public String pollSharedValue(String variableName);
  public void setValue(String variableName,
                       String value);
}

addSharedValue(String, String)

public boolean addSharedValue(String variableName,
                              String value);

Parameters

Adds a value to the shared queue.

If the queue has reached its maximum capacity, the value will not be added and the function returns false

changeValue(String)

public void changeValue(String variableName);

Parameters

Change the value of a declared variable, such as a File variable or a Counter variable.

createSharedQueue(String, int, int)

public boolean createSharedQueue(String variableName,
                                 int queueSize,
                                 int timeout);

Parameters

Creates a queue that is shared between the Virtual Users.

createSharedQueue(String, int, int, String, char, boolean, boolean)

public boolean createSharedQueue(String variableName,
                                 int queueSize,
                                 int timeout,
                                 String filename,
                                 char delimiter,
                                 boolean swapLoaded,
                                 boolean swapDumped);

Parameters

Creates a queue that is shared between the Virtual Users associated with a CSV swap file.

getSharedQueueSize(String)

public int getSharedQueueSize(String variableName);

Parameters

Returns the number of items in the shared queue, -1 if the queue does not exist.

getValue(String)

public String getValue(String variableName);

Parameters

Returns the value of a variable or null if the variable does not exist.

parseString(String)

public String parseString(String text);

Parameters

Evaluate a string that contains variables. For example, "the counter value is: ${counter}" will return "the counter value is: 7".

peekSharedValue(String)

public string peeksharedvalue(string variablename);

Parameters

Returns the first value in the shared queue without deleting it, or null if the queue does not exist.

If the queue does not contain any values, the value returned will be in the form ${variableName}

pollSharedValue(String)

public String pollSharedValue(String variableName);

Parameters

Returns the first value in the shared queue and deletes it, or null if the queue does not exist.

If the queue does not contain any values, the value returned will be in the form ${variableName}

setValue(String, String)

public void setValue(String variableName,
                     String value);

Parameters

Assigns a value to a runtime variable. The variable is created if it does not exist. Note that the variable name should be used, not the variable expression: use 'varname' and NOT '${varname}'. Nevertheless, the name can be compound, for example: "data_for_${login}" if variable "data_for_jsmith" is defined.

When using the name of a declared variable, a runtime variable will be created that will override the declared variable. Overriding declared variables is not recommended.