Package eu.simuline.testhelpers
Class GUIRunner
- java.lang.Object
-
- eu.simuline.testhelpers.GUIRunner
-
class GUIRunner extends java.lang.ObjectThe GUI of a JUnit test-runner. Comprises- a menubar to select running, stopping or breaking a testcase or even exiting the application
- A label for the name of the testclass.
-
A progress bar represented by the class
GUIRunner.TestProgressBar. -
A component displaying the number of tests to run,
already runned, ignored and failed.
This is an instance of the class
GUIRunner.StatisticsTestState. -
a treeview on the testsuite
represented by the class
GUIRunner.HierarchyWrapper. This needs support from the classes andGUIRunner.TreePathIterator,GUIRunner.TestTreeCellRenderer. -
a list of the testcases that failed in a sense
given as a
GUIRunner.TestCaseLister. -
Closely tied to the list of testcases failed so far,
is the list-view on the stacktraces
given by a
GUIRunner.StackTraceLister. - a statusbar.
-
Note that the selection on the treeview of all testcases
and on the listview of the testcases already failed
must be synchronized.
This is performed by the class
GUIRunner.TabChangeListenerand the interfaceGUIRunner.Selector.
GUIRunListeners to report the current state of the testsuitey. Created: Sat Jun 3 18:29:52 2006- Version:
- 1.0
- Author:
- Ernst Reissner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classGUIRunner.ClassChooserProvides a method to choose a test class.(package private) static classGUIRunner.HierarchyWrapperRepresents the hierarchy of testsuites and testcases as a treeGUIRunner.HierarchyWrapper.hierarchyTreepossibly with a single selected node given byGUIRunner.HierarchyWrapper.singleSelectedNode.(package private) static interfaceGUIRunner.SelectorMinimal interface for notifying about singular selection events.(package private) static classGUIRunner.StackTraceListerRepresents the stack trace of the throwable,GUIRunner.StackTraceLister.thrwcurrently selected in the error list.(package private) static classGUIRunner.StatisticsTestStateRepresents the table displaying the number of runs, both, passed and to be performed altogether, the tests already ignored and those a failure or an error was found.(package private) static classGUIRunner.TabChangeListenerA listener to the switching of a tab in the foreground; the other in the background.(package private) static classGUIRunner.TestCaseListerRepresents the list of testcases already failed shown in one of the tabs and aGUIRunner.TestCaseLister.stackTraceListerwhich represents the stack trace box below the tabbed pane.(package private) static classGUIRunner.TestListCellRendererA special renderer object consisting of a label and a location within java code for an item in a failure list.(package private) static classGUIRunner.TestProgressBarThe progress bar indicating how much of the testcases already passed.(package private) static classGUIRunner.TestTreeCellRendererTo render a cell of the hierarchy tree.(package private) static classGUIRunner.TreePathIteratorRepresents a pathGUIRunner.TreePathIterator.currPathin the tree of testsuites represented byGUIRunner.TreePathIterator.treeModel.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCHOOSE_CLASSPATHThe name of the system property the value of which points to the directory which is opened by the file chooser.private GUIRunner.ClassChooserclassChooserA chooser for testclasses.private javax.swing.JLabelclassNameContains the fully qualified name of the testclasse currently under consideration.private javax.swing.JFrameframeThe frame in which the Testrunne GUI is displayed.private static javax.swing.ImageIconHIERARCHY_ICONThe icon representing the hierarchy of tests: used for the tabbed pane.private static java.awt.ComponentHORIZ_BOUNDARYRepresents the horizontal space used for the boundary.private static java.awt.ComponentHORIZ_BOUNDARY2Represents double of the horizontal space used for the boundary.private static intHORIZ_FRAMEThe horizontal size of the frame.private static javax.swing.ImageIconLOGO_ICONThe (big) JUnit-logo.private GUIRunner.TestProgressBarprogressThe progress bar indicating how much of the testcases already passed.private static javax.swing.ImageIconSMALL_LOGO_ICONThe small JUnit-logo on top left of this frame. **** still this is not displayed properly ****.private static java.lang.StringSOURCEPATHThe name of the system property the value of which is the source path.private javax.swing.JSplitPanesplitPaneRepresents the split pane with a tabbed pane as top component and the stack trace box as bottom component.private GUIRunner.StatisticsTestStatestatisticsTestStateRepresents the table displaying the number of runs, both passed and to be performed altogether, the tests already ignored and those in which an error was found.private javax.swing.JLabelstatusBarContains a status message.private GUIRunner.TestCaseListertestCaseListerRepresents the list of testcases already failed.private GUIRunner.HierarchyWrappertestHierarchyRepresents the hierarchy of testcases.private static java.awt.ComponentVERTI_BOUNDARYRepresents the vertical space used for the boundary.private static intVERTI_FRAMEThe vertical size of the frame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidnoteReportResult(TestCase testCase)Notifies that the singular testtestCaseis finished, whether successful or not or that a test is ignored after invokingnoteTestStartedI(Quality)with parameterQuality.Ignored.(package private) TestCasenoteTestStartedI(Quality qual)Notifies that an atomic test is started or ignored.(package private) java.lang.StringopenClassChooser()Opens the class chooser dialog and returns the choosen class ornullif either no file was selected, a file is selected which does not exist or does not represent a java class file.(package private) voidsetCenter(Actions actions)(package private) voidsetMenuBar(Actions actions)private voidsetStatus(TestCase testCase)Sets a status message describingtestCaseto the status bar usingsetStatus(String).(package private) voidsetStatus(java.lang.String msg)Sets the messagemsgto the status bar.(package private) voidtestClassStructureLoaded(Description desc)Notifies that the structure of the test class may have been updated.(package private) voidtestRunAborted()Notifies that a test has been aborted by the user.(package private) voidtestRunFinished(long runTime)Notifies that a test has been finished sufficiently or not.(package private) voidtestRunStarted(Description desc)Notifies that a test with structure given bydescis going to be run next.private voidupdateG()
-
-
-
Field Detail
-
LOGO_ICON
private static final javax.swing.ImageIcon LOGO_ICON
The (big) JUnit-logo.
-
HIERARCHY_ICON
private static final javax.swing.ImageIcon HIERARCHY_ICON
The icon representing the hierarchy of tests: used for the tabbed pane.
-
SMALL_LOGO_ICON
private static final javax.swing.ImageIcon SMALL_LOGO_ICON
The small JUnit-logo on top left of this frame. **** still this is not displayed properly ****.
-
HORIZ_BOUNDARY
private static final java.awt.Component HORIZ_BOUNDARY
Represents the horizontal space used for the boundary.
-
HORIZ_BOUNDARY2
private static final java.awt.Component HORIZ_BOUNDARY2
Represents double of the horizontal space used for the boundary.
-
VERTI_BOUNDARY
private static final java.awt.Component VERTI_BOUNDARY
Represents the vertical space used for the boundary.
-
HORIZ_FRAME
private static final int HORIZ_FRAME
The horizontal size of the frame.- See Also:
- Constant Field Values
-
VERTI_FRAME
private static final int VERTI_FRAME
The vertical size of the frame.- See Also:
- Constant Field Values
-
CHOOSE_CLASSPATH
private static final java.lang.String CHOOSE_CLASSPATH
The name of the system property the value of which points to the directory which is opened by the file chooser. This is the directory containing the test classes.- See Also:
- Constant Field Values
-
SOURCEPATH
private static final java.lang.String SOURCEPATH
The name of the system property the value of which is the source path. This comprises the product sources (in maven called main sources) and the test sources. This is used to edit sources at places throwing an exception.- See Also:
- Constant Field Values
-
frame
private final javax.swing.JFrame frame
The frame in which the Testrunne GUI is displayed. Since this is the outermost component, this is used inGUIRunner.ClassChooserand inupdateG().
-
classChooser
private final GUIRunner.ClassChooser classChooser
A chooser for testclasses.
-
className
private final javax.swing.JLabel className
Contains the fully qualified name of the testclasse currently under consideration.
-
progress
private final GUIRunner.TestProgressBar progress
The progress bar indicating how much of the testcases already passed.
-
statisticsTestState
private final GUIRunner.StatisticsTestState statisticsTestState
Represents the table displaying the number of runs, both passed and to be performed altogether, the tests already ignored and those in which an error was found.
-
testCaseLister
private GUIRunner.TestCaseLister testCaseLister
Represents the list of testcases already failed. This is shown in one of the tabs.
-
testHierarchy
private GUIRunner.HierarchyWrapper testHierarchy
Represents the hierarchy of testcases. This is shown in one of the tabs.
-
splitPane
private javax.swing.JSplitPane splitPane
Represents the split pane with a tabbed pane as top component and the stack trace box as bottom component. The tabbed pane contains a tab for thetestCaseListerand another one for thetestHierarchy. The stack trace box is given byGUIRunner.TestCaseLister.getStackTraceBox().This field is used to reset to preferred size.
-
statusBar
private final javax.swing.JLabel statusBar
Contains a status message.
-
-
Constructor Detail
-
GUIRunner
GUIRunner(Actions actions)
Creates a newGUIRunnerinstance which defines components with unloaded test class. Loading is done by invokingtestClassStructureLoaded(Description).
-
-
Method Detail
-
openClassChooser
java.lang.String openClassChooser()
Opens the class chooser dialog and returns the choosen class ornullif either no file was selected, a file is selected which does not exist or does not represent a java class file.Essentially delegates to
GUIRunner.ClassChooser.getChosenClass().
-
setMenuBar
final void setMenuBar(Actions actions)
-
setCenter
final void setCenter(Actions actions)
-
updateG
private void updateG()
-
setStatus
void setStatus(java.lang.String msg)
Sets the messagemsgto the status bar.
-
setStatus
private void setStatus(TestCase testCase)
Sets a status message describingtestCaseto the status bar usingsetStatus(String).
-
noteTestStartedI
TestCase noteTestStartedI(Quality qual)
Notifies that an atomic test is started or ignored.- Parameters:
qual- the quality of the testcase: This is eitherQuality.StartedorQuality.Ignored.
-
noteReportResult
void noteReportResult(TestCase testCase)
Notifies that the singular testtestCaseis finished, whether successful or not or that a test is ignored after invokingnoteTestStartedI(Quality)with parameterQuality.Ignored.- Parameters:
testCase- The testcase comprising the result of the singular test finished.
-
testClassStructureLoaded
void testClassStructureLoaded(Description desc)
Notifies that the structure of the test class may have been updated.- Parameters:
desc- a description of the test structure defined in the test class which is a hierarchy of suites and singular tests.- See Also:
testRunStarted(Description)
-
testRunStarted
void testRunStarted(Description desc)
Notifies that a test with structure given bydescis going to be run next. Called before any tests have been run. At least once before this one,testClassStructureLoaded(Description)has been invoked.- Parameters:
desc- describes the (hierarchy of) tests to be run. This is a sub-hierarchy of the one given by the test class.
-
testRunFinished
void testRunFinished(long runTime)
Notifies that a test has been finished sufficiently or not.- Parameters:
runTime- the time execution of the test took in milliseconds.
-
testRunAborted
void testRunAborted()
Notifies that a test has been aborted by the user.
-
-