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
ConstructorsConstructorDescriptionConstructor, that preloads the variables from the JMeter properties -
Method Summary
Modifier and TypeMethodDescriptionentrySet()Gets the value of a variable, converted to a String.intGets a read-only Iterator over the variables.Gets the value of a variable (not converted to String).voidIncrease the current number of iterationsbooleanvoidCreates or updates a variable with a String value.voidUpdates the variables with all entries found in theMapvarsvoidputAll(JMeterVariables vars) Updates the variables with all entries found in the variables invarsvoidCreates 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
nullif 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 theMapvars- Parameters:
vars- map with the entries to be updated
-
putAll
Updates the variables with all entries found in the variables invars- Parameters:
vars-JMeterVariableswith 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
nullif 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
nullif 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
-