Class RuntimeContext
This class represents the execution context of the script.
It is accessible from the pre-defined variable: "context" and should not be created directly.
Example:
var myvar = context.variableManager.getValue("myvar"); if (myvar==null) { context.fail("Variable 'myvar' is not defined"); }Synopsis
public class RuntimeContext {
// Public Fields
public LoadGenerator currentLG ;
public VirtualUser currentVU ;
public VariableManager variableManager ;
// Public Methods
public void fail();
public void fail(String message);
public void fail(String errorCode,
String message);
public long getElapsedTime();
public String getTestStatus();
}currentLG
public LoadGenerator currentLG ;The Load Generator executing the current Virtual User.
currentVU
public VirtualUser currentVU ;The Virtual User currently running.
variableManager
public VariableManager variableManager ;The VariableManager
fail()
public void fail();Mark the current script as failed and stops the execution of the script. A default error message will be logged at ERROR level.
The script exits, but the Virtual User keeps running and goes to the next action.
fail(String)
public void fail(String message);Parameters
- message
The messageMark the current script as failed and stops the execution of the script. The specified message will be logged at ERROR level.
The script exits, but the Virtual User keeps running and goes to the next action.
fail(String, String)
public void fail(String errorCode,
String message);Parameters
- errorCode
the error code for the NeoLoad action- message
The messageMark the current script as failed and stops the execution of the script. The specified message will be logged at ERROR level.
The script exits, but the Virtual User keeps running and goes to the next action.
getElapsedTime()
public long getElapsedTime();Parameters
- return
the difference, measured in milliseconds, between the current time and the test start time.Returns the elapsed time in milliseconds since the test started.
getTestStatus()
public String getTestStatus();Parameters
- return
the current test status "RUNNING" or "STOPPING".Returns the current status of the test. The test state can be "RUNNING" or "STOPPING".
Home