public final class Context
extends java.lang.Object
Global object which stores context variables. They are represented as an association between logical name (represented with the string) and actual value. It is mainly needed for data transfer between steps while using BDD instructions.
Additionally this object handles multiple threads. So, if some tests are running in parallel threads, the context variables will not be overridden. Instead they will be stored in the separate storage associated with dedicated thread.
Modifier and Type | Method and Description |
---|---|
static void |
clearCurrent()
Clears all variables data for current thread.
|
static java.lang.Object |
get(java.lang.String name)
Gets the value of the variable specified by name parameter
or null if no such variable available.
|
static void |
put(java.lang.String name,
java.lang.Object value)
Assigns new value to the variable defined with the name parameter.
|
static void |
reset()
Resets all internal data storage for all context variables.
|
static java.util.Set<java.lang.String> |
variables()
Lists all available variables for current thread.
|
public static void put(java.lang.String name, java.lang.Object value)
name
- the variable name to assign.value
- the value to assign.public static java.lang.Object get(java.lang.String name)
name
- the name of variable to get value of.public static void clearCurrent()
public static void reset()
public static java.util.Set<java.lang.String> variables()