abbot.script
Class StepRunner

java.lang.Object
  |
  +--abbot.script.StepRunner
Direct Known Subclasses:
ForkedStepRunner, ForkedStepRunner.SlaveStepRunner

public class StepRunner
extends Object


Constructor Summary
StepRunner()
          Provides control and tracking of the execution of a step or series of steps.
 
Method Summary
 void addStepListener(StepListener sl)
           
protected  void clearErrors()
           
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)
           
 Throwable getError(Step step)
           
 boolean getStopOnError()
           
 boolean getStopOnFailure()
           
 void launch(Script script)
          Invoke the given script's launch step, if any.
 void removeStepListener(StepListener sl)
           
 void run(Step step)
          Run the given script, propagating any failures or errors.
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.
protected  void setUp()
          Set up an appropriate environment for launching an app under test.
 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.
protected  void tearDown()
          Restore (to the extent possible) the environment prior to running.
 void terminate()
          Dispose of any extant windows and restore any saved environment state.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StepRunner

public StepRunner()
Provides control and tracking of the execution of a step or series of steps. By default the runner stops execution on the first encountered failure/error. The running environment is preserved to the extent possible, which includes discarding any GUI components created by the code under test.

If you wish to preserve the application state when there is an error, you can use the method setTerminateOnError(false).

Method Detail

setStopOnFailure

public void setStopOnFailure(boolean stop)

setStopOnError

public void setStopOnError(boolean stop)

getStopOnFailure

public boolean getStopOnFailure()

getStopOnError

public boolean getStopOnError()

stop

public void stop()
Stop execution of the script after the current step completes. The launched application will be left in its current state.

stop

public void stop(boolean terminate)
Stop execution, indicating whether to terminate the app.

stopped

public boolean stopped()
Return whether the runner has been stopped.

setUp

protected void setUp()
Set up an appropriate environment for launching an app under test. This includes the following:

tearDown

protected void tearDown()
Restore (to the extent possible) the environment prior to running.

run

public void run(Step step)
         throws Throwable
Run the given script, propagating any failures or errors. If the given step is a script, preserves and restores the current test environment.

setTerminateOnError

public void setTerminateOnError(boolean state)
Set whether the application under test should be terminated when an error is encountered and script execution stopped. The default implementation always terminates.

clearErrors

protected void clearErrors()

runStep

protected void runStep(Step step)
                throws Throwable
Main run method, which stores any failures or exceptions for later retrieval. Any step will fire STEP_START 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.

launch

public void launch(Script script)
            throws Throwable
Invoke the given script's launch step, if any. Preserves the current environment for later restore via the terminate method.

terminate

public void terminate()
Dispose of any extant windows and restore any saved environment state.

setError

protected void setError(Step step,
                        Throwable thr)

getError

public Throwable getError(Step step)

addStepListener

public void addStepListener(StepListener sl)

removeStepListener

public void removeStepListener(StepListener sl)

fireStepEvent

protected void fireStepEvent(StepEvent event)
If this is used to propagate a failure/error, be sure to invoke setError on the step first.

fireStepStart

protected void fireStepStart(Step step)

fireStepProgress

protected void fireStepProgress(Step step,
                                int val)

fireStepEnd

protected void fireStepEnd(Step step)

fireStepFailure

protected void fireStepFailure(Step step,
                               Throwable afe)

fireStepError

protected void fireStepError(Step step,
                             Throwable thr)


Copyright © 2002-2003 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge