Package eu.simuline.testhelpers
Class Actions
- java.lang.Object
-
- eu.simuline.testhelpers.Actions
-
public final class Actions extends java.lang.ObjectRepresents the actions of the test GUI inspired by old junit GUI. **** Moreover provides a wrapper to access junit and the access point to run the gui started from the class to be tested. **** The fundamental methods arerunFromMain()which runs the test class from its main method andrunTestClass(String)which runs a testclass with the given name.- Version:
- 1.0
- Author:
- Ernst Reissner
- See Also:
GUIRunner,Created: Tue Jun 13 02:53:06 2006
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classActions.BreakActionThe action of breaking the sequence of testcases currently running.(package private) classActions.CoreRunnerA thread in which a testclass is executed or at least a single testcase out of this testclass.(package private) static classActions.ExitActionThe action of exiting the tester application.(package private) classActions.OpenActionThe action of opening ajava-file defining a test class and starting the tests defined by it.(package private) classActions.StartActionThe action of starting the testcases in the loaded testclass.(package private) classActions.StopActionThe action of stopping the test run// after having finished the currently running testcase.
-
Field Summary
Fields Modifier and Type Field Description private Actions.BreakActionbreakActionThe action to break execution of testcases.private Actions.CoreRunnercoreRunnerprivate DescriptionfilterDefines the filter for tests to be run. **** may be nullprivate GUIRunnerguiRunnerprivate booleanisRunningDefines whether a test is running.private ExtRunListenerlistenerprivate Actions.OpenActionopenActionThe action to open a new testclass.private Actions.StartActionstartActionThe action to run a testcase.private Actions.StopActionstopActionThe action to stop after having finished the currently running testcase.
-
Constructor Summary
Constructors Constructor Description Actions(java.lang.String testClassName)Creates a newActionsinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Filterdesc2filter(Description desiredDesc)Returns aFilterthat only runs methods in desiredDesc.private static booleandescShouldRun(Description desc, Description desiredDesc)(package private) javax.swing.AbstractActiongetBreakAction()(package private) javax.swing.AbstractActiongetExitAction()(package private) javax.swing.AbstractActiongetOpenAction()(package private) GUIRunnergetRunner()(package private) javax.swing.AbstractActiongetStartAction()(package private) javax.swing.AbstractActiongetStopAction()static voidmain(java.lang.String[] args)static voidrunFromMain()The fundamental method to start tests with the underlying JUnit-GUI.(package private) static voidrunTestClass(java.lang.String testClassName)The fundamental method to start tests with the underlying JUnit-GUI.(package private) voidsetEnableForRun(boolean isRunning)Updates the action-enablements depending on whether a test is running or not: Open and Start action are enabled iff no test is running, whereas stop and break actions are enabled iff some test is running.(package private) voidsetFilter(Description filter)Setsfilteraccording tofilter.
-
-
-
Field Detail
-
openAction
private final Actions.OpenAction openAction
The action to open a new testclass.
-
startAction
private final Actions.StartAction startAction
The action to run a testcase.
-
stopAction
private final Actions.StopAction stopAction
The action to stop after having finished the currently running testcase.
-
breakAction
private final Actions.BreakAction breakAction
The action to break execution of testcases. Tries to break the currently running testcase and does not go on with further testcases.
-
guiRunner
private final GUIRunner guiRunner
-
coreRunner
private Actions.CoreRunner coreRunner
-
listener
private final ExtRunListener listener
-
isRunning
private boolean isRunning
Defines whether a test is running. This is used to activate/deactivate the actionsopenAction,startAction,stopActionandbreakAction.
-
filter
private Description filter
Defines the filter for tests to be run. **** may be null- See Also:
setFilter(Description),Actions.CoreRunner.run()
-
-
Method Detail
-
descShouldRun
private static boolean descShouldRun(Description desc, Description desiredDesc)
-
desc2filter
public static Filter desc2filter(Description desiredDesc)
Returns aFilterthat only runs methods in desiredDesc.- Parameters:
desiredDesc- a description of the tests to be run.- Returns:
- a
Filterthat only runs methods indesiredDesc.
-
runTestClass
static void runTestClass(java.lang.String testClassName)
The fundamental method to start tests with the underlying JUnit-GUI. The test class is supposed to define a methodmainwith bodyActions.run(<testclass>.class);.- Parameters:
testClassName- the name of the test class to represent and run.- See Also:
JUnitSingleTester,runFromMain()
-
runFromMain
public static void runFromMain()
The fundamental method to start tests with the underlying JUnit-GUI. The test class is supposed to define a methodmainwith bodyActions.runFromMain();. Essentially invokesrunTestClass(String)with the proper test class name.
-
getRunner
GUIRunner getRunner()
-
setFilter
void setFilter(Description filter)
Setsfilteraccording tofilter.- Parameters:
filter- the filter for the tests to be run
-
setEnableForRun
void setEnableForRun(boolean isRunning)
Updates the action-enablements depending on whether a test is running or not: Open and Start action are enabled iff no test is running, whereas stop and break actions are enabled iff some test is running.- Parameters:
isRunning- whether a test is running.
-
getOpenAction
javax.swing.AbstractAction getOpenAction()
-
getStartAction
javax.swing.AbstractAction getStartAction()
-
getStopAction
javax.swing.AbstractAction getStopAction()
-
getBreakAction
javax.swing.AbstractAction getBreakAction()
-
getExitAction
javax.swing.AbstractAction getExitAction()
-
main
public static void main(java.lang.String[] args)
-
-