Package eu.simuline.testhelpers
Class GUIRunListener
- java.lang.Object
-
- org.junit.runner.notification.RunListener
-
- eu.simuline.testhelpers.ExtRunListener
-
- eu.simuline.testhelpers.GUIRunListener
-
public final class GUIRunListener extends ExtRunListener
AnExtRunListener
which notifies the GUIGUIRunner
of the events occuring while running a testsuite and which comprises a textual run listener. Created: Sat Jun 3 17:17:23 2006- Version:
- 1.0
- Author:
- Ernst Reissner
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.junit.runner.notification.RunListener
RunListener.ThreadSafe
-
-
Constructor Summary
Constructors Constructor Description GUIRunListener(GUIRunner guiRunner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
testAssumptionFailure(Failure failure)
Called when an atomic test flags that it assumes a condition that is false.void
testClassStructureLoaded(Description desc)
Invoked if a test class is loaded defining a testsuite described bydesc
.void
testFailure(Failure failure)
Called when an atomic test fails to execute properly throwing a Throwable.void
testFinished(Description desc)
Called when an atomic test has finished, whether the test succeeds or fails.void
testIgnored(Description desc)
Called when a test will not be run, generally because a test method is annotated with@Ignored
.void
testRunAborted()
Invoked for stop and for break originated by the user.void
testRunFinished(Result result)
Called when all tests have finished.void
testRunStarted(Description desc)
Called before any tests have been run.void
testStarted(Description desc)
Called when an atomic test is about to be started.void
testSuiteFinished(Description desc)
Called when a test suite has finished, whether the test suite succeeds or fails.void
testSuiteStarted(Description desc)
Called when a test suite is about to be started.
-
-
-
Constructor Detail
-
GUIRunListener
public GUIRunListener(GUIRunner guiRunner)
-
-
Method Detail
-
testRunStarted
public void testRunStarted(Description desc) throws java.lang.Exception
Called before any tests have been run. Updates the enablement of the GUI-Actions and then delegates toGUIRunner.testRunStarted(Description)
. Updates the enablement of the GUI-Actions and ***** OVERWRITTEN FOR ALL- Overrides:
testRunStarted
in classRunListener
- Parameters:
desc
- describes the tests to be run- Throws:
java.lang.Exception
-
testRunFinished
public void testRunFinished(Result result) throws java.lang.Exception
Called when all tests have finished. Prints a statistics on the result to the standard output, a summary to the status bar of the GUI and updates the enablement of the GUI-Actions.- Overrides:
testRunFinished
in classRunListener
- Parameters:
result
- the summary of the test run, including all the tests that failed- Throws:
java.lang.Exception
-
testSuiteStarted
public void testSuiteStarted(Description desc) throws java.lang.Exception
Called when a test suite is about to be started. If this method is called for a givenDescription
, thentestSuiteFinished(Description)
will also be called for the sameDescription
.Note that not all runners will call this method, so runners should be prepared to handle
testStarted(Description)
calls for tests where there was no coorespondingtestSuiteStarted(Description)
call for the parentDescription
.- Overrides:
testSuiteStarted
in classExtRunListener
- Parameters:
desc
- the description of the test suite that is about to be run (generally a class name)- Throws:
java.lang.Exception
- Since:
- 4.13
-
testSuiteFinished
public void testSuiteFinished(Description desc) throws java.lang.Exception
Called when a test suite has finished, whether the test suite succeeds or fails. This method will not be called for a givenDescription
unlesstestSuiteStarted(Description)
was called for the sameDescription
.- Overrides:
testSuiteFinished
in classExtRunListener
- Parameters:
desc
- the description of the test suite that just ran- Throws:
java.lang.Exception
- Since:
- 4.13
-
testStarted
public void testStarted(Description desc) throws java.lang.Exception
Called when an atomic test is about to be started. An ignored test is never started.- Overrides:
testStarted
in classRunListener
- Parameters:
desc
- the description of the test that is about to be started (generally a class and method name)- Throws:
java.lang.Exception
- See Also:
testIgnored(Description)
-
testFinished
public void testFinished(Description desc) throws java.lang.Exception
Called when an atomic test has finished, whether the test succeeds or fails. This method must be invoked after a test has been started which was indicated bytestStarted(Description)
before. An ignored test is never finished.- Overrides:
testFinished
in classRunListener
- Parameters:
desc
- the description of the test that just ran- Throws:
java.lang.Exception
- See Also:
testIgnored(Description)
-
testFailure
public void testFailure(Failure failure) throws java.lang.Exception
Called when an atomic test fails to execute properly throwing a Throwable. This method is invoked aftertestStarted(Description)
and beforetestFinished(Description)
with the according description. In case of a failed assumption, instead of this methodtestAssumptionFailure(Failure)
is invoked for the according test.- Overrides:
testFailure
in classRunListener
- Parameters:
failure
- describes the test that failed and the exception that was thrown- Throws:
java.lang.Exception
-
testAssumptionFailure
public void testAssumptionFailure(Failure failure)
Called when an atomic test flags that it assumes a condition that is false. This is treated as ignored with the description of the failure. This method is invoked aftertestStarted(Description)
and beforetestFinished(Description)
with the according description. A failed assertion does not count as a failure and sotestFailure(Failure)
is not invoked for the according test.CAUTION: Although a failed assertion is like an ignored test,
testRunFinished(Result)
does not count this as ignored test but rather than a passed test.- Overrides:
testAssumptionFailure
in classRunListener
- Parameters:
failure
- describes the test that failed and theAssumptionViolatedException
that was thrown.- See Also:
testIgnored(Description)
-
testIgnored
public void testIgnored(Description desc) throws java.lang.Exception
Called when a test will not be run, generally because a test method is annotated with@Ignored
. This implies that neithertestStarted(Description)
nortestFinished(Description)
are invoked for the according test. This in turn implies that neithertestFailure(Failure)
nortestAssumptionFailure(Failure)
are invoked. are invoked.- Overrides:
testIgnored
in classRunListener
- Parameters:
desc
- describes the test that will not be run- Throws:
java.lang.Exception
-
testRunAborted
public void testRunAborted()
Invoked for stop and for break originated by the user.- Overrides:
testRunAborted
in classExtRunListener
-
testClassStructureLoaded
public void testClassStructureLoaded(Description desc)
Invoked if a test class is loaded defining a testsuite described bydesc
.- Overrides:
testClassStructureLoaded
in classExtRunListener
-
-