Package eu.simuline.testhelpers
Class GUIRunner
- java.lang.Object
-
- eu.simuline.testhelpers.GUIRunner
-
class GUIRunner extends java.lang.Object
The 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.TabChangeListener
and the interfaceGUIRunner.Selector
.
GUIRunListener
s 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) class
GUIRunner.ClassChooser
Provides a method to choose a test class.(package private) static class
GUIRunner.HierarchyWrapper
Represents the hierarchy of testsuites and testcases as a treeGUIRunner.HierarchyWrapper.hierarchyTree
possibly with a single selected node given byGUIRunner.HierarchyWrapper.singleSelectedNode
.(package private) static interface
GUIRunner.Selector
Minimal interface for notifying about singular selection events.(package private) static class
GUIRunner.StackTraceLister
Represents the stack trace of the throwable,GUIRunner.StackTraceLister.thrw
currently selected in the error list.(package private) static class
GUIRunner.StatisticsTestState
Represents 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 class
GUIRunner.TabChangeListener
A listener to the switching of a tab in the foreground; the other in the background.(package private) static class
GUIRunner.TestCaseLister
Represents the list of testcases already failed shown in one of the tabs and aGUIRunner.TestCaseLister.stackTraceLister
which represents the stack trace box below the tabbed pane.(package private) static class
GUIRunner.TestListCellRenderer
A special renderer object consisting of a label and a location within java code for an item in a failure list.(package private) static class
GUIRunner.TestProgressBar
The progress bar indicating how much of the testcases already passed.(package private) static class
GUIRunner.TestTreeCellRenderer
To render a cell of the hierarchy tree.(package private) static class
GUIRunner.TreePathIterator
Represents a pathGUIRunner.TreePathIterator.currPath
in the tree of testsuites represented byGUIRunner.TreePathIterator.treeModel
.
-
Field Summary
Fields Modifier and Type Field Description private static 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.private GUIRunner.ClassChooser
classChooser
A chooser for testclasses.private javax.swing.JLabel
className
Contains the fully qualified name of the testclasse currently under consideration.private javax.swing.JFrame
frame
The frame in which the Testrunne GUI is displayed.private static javax.swing.ImageIcon
HIERARCHY_ICON
The icon representing the hierarchy of tests: used for the tabbed pane.private static java.awt.Component
HORIZ_BOUNDARY
Represents the horizontal space used for the boundary.private static java.awt.Component
HORIZ_BOUNDARY2
Represents double of the horizontal space used for the boundary.private static int
HORIZ_FRAME
The horizontal size of the frame.private static javax.swing.ImageIcon
LOGO_ICON
The (big) JUnit-logo.private GUIRunner.TestProgressBar
progress
The progress bar indicating how much of the testcases already passed.private static javax.swing.ImageIcon
SMALL_LOGO_ICON
The small JUnit-logo on top left of this frame. **** still this is not displayed properly ****.private static java.lang.String
SOURCEPATH
The name of the system property the value of which is the source path.private javax.swing.JSplitPane
splitPane
Represents the split pane with a tabbed pane as top component and the stack trace box as bottom component.private 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.private javax.swing.JLabel
statusBar
Contains a status message.private GUIRunner.TestCaseLister
testCaseLister
Represents the list of testcases already failed.private GUIRunner.HierarchyWrapper
testHierarchy
Represents the hierarchy of testcases.private static java.awt.Component
VERTI_BOUNDARY
Represents the vertical space used for the boundary.private static int
VERTI_FRAME
The vertical size of the frame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
noteReportResult(TestCase testCase)
Notifies that the singular testtestCase
is finished, whether successful or not or that a test is ignored after invokingnoteTestStartedI(Quality)
with parameterQuality.Ignored
.(package private) TestCase
noteTestStartedI(Quality qual)
Notifies that an atomic test is started or ignored.(package private) java.lang.String
openClassChooser()
Opens the class chooser dialog and returns the choosen class ornull
if either no file was selected, a file is selected which does not exist or does not represent a java class file.(package private) void
setCenter(Actions actions)
(package private) void
setMenuBar(Actions actions)
private void
setStatus(TestCase testCase)
Sets a status message describingtestCase
to the status bar usingsetStatus(String)
.(package private) void
setStatus(java.lang.String msg)
Sets the messagemsg
to the status bar.(package private) void
testClassStructureLoaded(Description desc)
Notifies that the structure of the test class may have been updated.(package private) void
testRunAborted()
Notifies that a test has been aborted by the user.(package private) void
testRunFinished(long runTime)
Notifies that a test has been finished sufficiently or not.(package private) void
testRunStarted(Description desc)
Notifies that a test with structure given bydesc
is going to be run next.private void
updateG()
-
-
-
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.ClassChooser
and 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 thetestCaseLister
and 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 newGUIRunner
instance 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 ornull
if 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 messagemsg
to the status bar.
-
setStatus
private void setStatus(TestCase testCase)
Sets a status message describingtestCase
to 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.Started
orQuality.Ignored
.
-
noteReportResult
void noteReportResult(TestCase testCase)
Notifies that the singular testtestCase
is 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 bydesc
is 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.
-
-