public class StepRunner extends Object
If you wish to preserve the application state when there is an error,
you can use the method setTerminateOnError(boolean)
.
Modifier and Type | Class and Description |
---|---|
protected class |
StepRunner.ExitHandler |
Modifier and Type | Field and Description |
---|---|
protected AWTFixtureHelper |
helper |
protected Hierarchy |
hierarchy |
Constructor and Description |
---|
StepRunner()
This ctor uses a new instance of TestHierarchy as the
default Hierarchy.
|
StepRunner(AWTFixtureHelper helper)
Create a new runner.
|
Modifier and Type | Method and Description |
---|---|
void |
addStepListener(StepListener sl) |
protected void |
checkFile(Script script)
Throw an exception if the file does not exist.
|
protected void |
clearErrors() |
protected SecurityManager |
createSecurityManager()
Create a security manager to use for the duration of this runner's
execution.
|
protected void |
fireStepEnd(Step step) |
protected void |
fireStepError(Step step,
Throwable thr) |
protected void |
fireStepEvent(StepEvent event)
If this is used to propagate a failure/error, be sure to invoke
setError on the step first.
|
protected void |
fireStepFailure(Step step,
Throwable afe) |
protected void |
fireStepProgress(Step step,
int val) |
protected void |
fireStepStart(Step step) |
UIContext |
getCurrentContext() |
Throwable |
getError(Step step) |
Hierarchy |
getHierarchy() |
boolean |
getStopOnError() |
boolean |
getStopOnFailure() |
boolean |
getTerminateOnError() |
protected void |
installSecurityManager()
Install a security manager to ensure we prevent the AUT from
exiting and can clean up when it tries to.
|
void |
launch(Script step)
|
protected void |
removeSecurityManager() |
void |
removeStepListener(StepListener sl) |
void |
run(Step step)
Run the given step, propagating any failures or errors to
listeners.
|
protected void |
runStep(Step step)
Main run method, which stores any failures or exceptions for later
retrieval.
|
protected void |
setError(Step step,
Throwable thr) |
void |
setStopOnError(boolean stop) |
void |
setStopOnFailure(boolean stop) |
void |
setTerminateOnError(boolean state)
Set whether the application under test should be terminated when an
error is encountered and script execution stopped.
|
void |
stop()
Stop execution of the script after the current step completes.
|
void |
stop(boolean terminate)
Stop execution, indicating whether to terminate the app.
|
boolean |
stopped()
Return whether the runner has been stopped.
|
void |
terminate()
Dispose of any extant windows and restore any saved environment
state.
|
protected AWTFixtureHelper helper
protected Hierarchy hierarchy
public StepRunner()
public StepRunner(AWTFixtureHelper helper)
Hierarchy
maintains which GUI
components are in or out of scope of the runner. The AWTFixtureHelper
will be used to restore state if terminate()
is called.public Hierarchy getHierarchy()
StepRunner
,
or null
if none.public UIContext getCurrentContext()
public void setStopOnFailure(boolean stop)
public void setStopOnError(boolean stop)
public boolean getStopOnFailure()
public boolean getStopOnError()
public void stop()
public void stop(boolean terminate)
public boolean stopped()
protected SecurityManager createSecurityManager()
System.exit(int)
and invokes terminate()
instead.protected void installSecurityManager()
protected void removeSecurityManager()
public void run(Step step) throws Throwable
terminate()
method will be invoked if the script is
stopped for any reason, unless setTerminateOnError(boolean)
has been called with a false
argument. Otherwise
terminate()
will only be called if a
Terminate
step is encountered.Throwable
terminate()
public void setTerminateOnError(boolean state)
public boolean getTerminateOnError()
protected void clearErrors()
protected void checkFile(Script script) throws InvalidScriptException
InvalidScriptException
protected void runStep(Step step) throws Throwable
StepListener
s on starting, and exactly one
of STEP_END, STEP_FAILURE, or STEP_ERROR upon termination. If
stopOnFailure/stopOnError is set false, then both STEP_FAILURE/ERROR
may be sent in addition to STEP_END.Throwable
public void launch(Script step) throws Throwable
run(Step)
, but defers to the Script
to determine what subset of steps should be run as the UI context.step
- Throwable
public void terminate()
public void addStepListener(StepListener sl)
public void removeStepListener(StepListener sl)
protected void fireStepEvent(StepEvent event)
protected void fireStepStart(Step step)
protected void fireStepProgress(Step step, int val)
protected void fireStepEnd(Step step)
Abbot is hosted on