Package eu.simuline.testhelpers
Class Actions
- java.lang.Object
-
- eu.simuline.testhelpers.Actions
-
public final class Actions extends java.lang.Object
Represents 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) class
Actions.BreakAction
The action of breaking the sequence of testcases currently running.(package private) class
Actions.CoreRunner
A thread in which a testclass is executed or at least a single testcase out of this testclass.(package private) static class
Actions.ExitAction
The action of exiting the tester application.(package private) class
Actions.OpenAction
The action of opening ajava
-file defining a test class and starting the tests defined by it.(package private) class
Actions.StartAction
The action of starting the testcases in the loaded testclass.(package private) class
Actions.StopAction
The action of stopping the test run// after having finished the currently running testcase.
-
Field Summary
Fields Modifier and Type Field Description private Actions.BreakAction
breakAction
The action to break execution of testcases.private Actions.CoreRunner
coreRunner
private Description
filter
Defines the filter for tests to be run. **** may be nullprivate GUIRunner
guiRunner
private boolean
isRunning
Defines whether a test is running.private ExtRunListener
listener
private Actions.OpenAction
openAction
The action to open a new testclass.private Actions.StartAction
startAction
The action to run a testcase.private Actions.StopAction
stopAction
The action to stop after having finished the currently running testcase.
-
Constructor Summary
Constructors Constructor Description Actions(java.lang.String testClassName)
Creates a newActions
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Filter
desc2filter(Description desiredDesc)
Returns aFilter
that only runs methods in desiredDesc.private static boolean
descShouldRun(Description desc, Description desiredDesc)
(package private) javax.swing.AbstractAction
getBreakAction()
(package private) javax.swing.AbstractAction
getExitAction()
(package private) javax.swing.AbstractAction
getOpenAction()
(package private) GUIRunner
getRunner()
(package private) javax.swing.AbstractAction
getStartAction()
(package private) javax.swing.AbstractAction
getStopAction()
static void
main(java.lang.String[] args)
static void
runFromMain()
The fundamental method to start tests with the underlying JUnit-GUI.(package private) static void
runTestClass(java.lang.String testClassName)
The fundamental method to start tests with the underlying JUnit-GUI.(package private) 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.(package private) void
setFilter(Description filter)
Setsfilter
according 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
,stopAction
andbreakAction
.
-
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 aFilter
that only runs methods in desiredDesc.- Parameters:
desiredDesc
- a description of the tests to be run.- Returns:
- a
Filter
that 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 methodmain
with 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 methodmain
with bodyActions.runFromMain();
. Essentially invokesrunTestClass(String)
with the proper test class name.
-
getRunner
GUIRunner getRunner()
-
setFilter
void setFilter(Description filter)
Setsfilter
according 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)
-
-