Package org.apache.jmeter.threads
Class JMeterVariables
java.lang.Object
org.apache.jmeter.threads.JMeterVariables
Class which defines JMeter variables.
These are similar to properties, but they are local to a single thread.
-
Constructor Summary
ConstructorDescriptionConstructor, that preloads the variables from the JMeter properties -
Method Summary
Modifier and TypeMethodDescriptionentrySet()
Gets the value of a variable, converted to a String.int
Gets a read-only Iterator over the variables.Gets the value of a variable (not converted to String).void
Increase the current number of iterationsboolean
void
Creates or updates a variable with a String value.void
Updates the variables with all entries found in theMap
vars
void
putAll
(JMeterVariables vars) Updates the variables with all entries found in the variables invars
void
Creates or updates a variable with a value that does not have to be a String.Remove a variable.
-
Constructor Details
-
JMeterVariables
public JMeterVariables()Constructor, that preloads the variables from the JMeter properties
-
-
Method Details
-
getThreadName
- Returns:
- the name of the currently running thread
-
getIteration
public int getIteration()- Returns:
- the current number of iterations
-
incIteration
public void incIteration()Increase the current number of iterations -
remove
Remove a variable.- Parameters:
key
- the variable name to remove- Returns:
- the variable value, or
null
if there was no such variable
-
put
Creates or updates a variable with a String value.- Parameters:
key
- the variable namevalue
- the variable value
-
putObject
Creates or updates a variable with a value that does not have to be a String.- Parameters:
key
- the variable namevalue
- the variable value
-
putAll
Updates the variables with all entries found in theMap
vars
- Parameters:
vars
- map with the entries to be updated
-
putAll
Updates the variables with all entries found in the variables invars
- Parameters:
vars
-JMeterVariables
with the entries to be updated
-
get
Gets the value of a variable, converted to a String.- Parameters:
key
- the name of the variable- Returns:
- the value of the variable or a toString called on it if it's non String, or
null
if it does not exist
-
getObject
Gets the value of a variable (not converted to String).- Parameters:
key
- the name of the variable- Returns:
- the value of the variable, or
null
if it does not exist
-
getIterator
Gets a read-only Iterator over the variables.- Returns:
- the iterator
-
entrySet
- Returns:
- an unmodifiable view of the entries contained in
JMeterVariables
-
isSameUserOnNextIteration
public boolean isSameUserOnNextIteration()- Returns:
- boolean true if user is the same on next iteration of Thread loop, false otherwise
-