Class TextRunListener
- java.lang.Object
- 
- org.junit.runner.notification.RunListener
- 
- eu.simuline.testhelpers.ExtRunListener
- 
- eu.simuline.testhelpers.TextRunListener
 
 
 
- 
 public final class TextRunListener extends ExtRunListener A simple RunListener which notifies of the events while running tests by text output. Created: Wed Jun 7 16:41:14 2006- Version:
- 1.0
- Author:
- Ernst Reissner
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.junit.runner.notification.RunListenerRunListener.ThreadSafe
 
- 
 - 
Constructor SummaryConstructors Constructor Description TextRunListener()Creates a newTextRunListenerinstance.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.Stringdesc2string(Description desc)Returns a string representation ofdesc: For atomic tests the display name, for suites an xml-style description.voidtestAssumptionFailure(Failure failure)Called when an atomic test flags that it assumes a condition that is false.voidtestClassStructureLoaded(Description desc)Invoked if a test class is loaded defining a testsuite described bydesc.voidtestFailure(Failure failure)Called when an atomic test fails to execute properly throwing a Throwable, or when a listener throws an exception.voidtestFinished(Description desc)Called when an atomic test has finished, whether the test succeeds or fails.voidtestIgnored(Description desc)Called when a test will not be run, generally because a test method is annotated withIgnore.voidtestRunAborted()Invoked for stop and for break originated by the user.voidtestRunFinished(Result result)Called when all tests of the suite announced bytestRunStarted(Description)have finished.voidtestRunStarted(Description desc)Called before any tests of a suite described bydeschave been run.voidtestStarted(Description desc)Called when an atomic test is about to be started.voidtestSuiteFinished(Description desc)Called when a test suite has finished, whether the test suite succeeds or fails.voidtestSuiteStarted(Description desc)Called when a test suite is about to be started.
 
- 
- 
- 
Method Detail- 
desc2stringprivate static java.lang.String desc2string(Description desc) Returns a string representation ofdesc: For atomic tests the display name, for suites an xml-style description.
 - 
testRunStartedpublic void testRunStarted(Description desc) throws java.lang.Exception Called before any tests of a suite described bydeschave been run. This may be called on an arbitrary thread.- Overrides:
- testRunStartedin class- RunListener
- Parameters:
- desc- describes the suite of tests to be run.
- Throws:
- java.lang.Exception
 
 - 
testRunFinishedpublic void testRunFinished(Result result) throws java.lang.Exception Called when all tests of the suite announced bytestRunStarted(Description)have finished. This may be called on an arbitrary thread.Prints a statistics on the result of the test suite to the standard output. - Overrides:
- testRunFinishedin class- RunListener
- Parameters:
- result- the summary of the outcoming of the suite of tests run, including all the tests that failed
- Throws:
- java.lang.Exception
 
 - 
testSuiteStartedpublic 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 correspondingtestSuiteStarted(Description)call for the parentDescription.- Overrides:
- testSuiteStartedin class- ExtRunListener
- 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
 
 - 
testSuiteFinishedpublic 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 givenDescriptionunlesstestSuiteStarted(Description)was called for the sameDescription.- Overrides:
- testSuiteFinishedin class- ExtRunListener
- Parameters:
- desc- the description of the test suite that just ran
- Throws:
- java.lang.Exception
- Since:
- 4.13
 
 - 
testStartedpublic 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:
- testStartedin class- RunListener
- Parameters:
- desc- the description of the test that is about to be run (generally a class and method name)
- Throws:
- java.lang.Exception
- See Also:
- testIgnored(Description)
 
 - 
testFinishedpublic 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:
- testFinishedin class- RunListener
- Parameters:
- desc- the description of the test that just ran
- Throws:
- java.lang.Exception
- See Also:
- testIgnored(Description)
 
 - 
testFailurepublic void testFailure(Failure failure) throws java.lang.Exception Called when an atomic test fails to execute properly throwing a Throwable, or when a listener throws an exception.In the case of a failure of an atomic test, this method is invoked after testStarted(Description)and beforetestFinished(Description)with the according description offailurefrom the same thread that calledtestStarted(Description). In case of a failed assumption, instead of this methodtestAssumptionFailure(Failure)is invoked for the according test.In the case of a listener throwing an exception, this method will be called with the description of failuregiven byDescription.TEST_MECHANISM, and may be called on an arbitrary thread.- Overrides:
- testFailurein class- RunListener
- Parameters:
- failure- describes the test that failed and the exception that was thrown or indicates that a listener has thrown an exception and the according exception.
- Throws:
- java.lang.Exception
 
 - 
testAssumptionFailurepublic 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 offailure. 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:
- testAssumptionFailurein class- RunListener
- Parameters:
- failure- describes the test that failed and the- AssumptionViolatedExceptionthat was thrown.
- See Also:
- testIgnored(Description)
 
 - 
testIgnoredpublic void testIgnored(Description desc) throws java.lang.Exception Called when a test will not be run, generally because a test method is annotated withIgnore. This implies that neithertestStarted(Description)nortestFinished(Description)are invoked for the according test. This in turn implies that neithertestFailure(Failure)nortestAssumptionFailure(Failure)are invoked.- Overrides:
- testIgnoredin class- RunListener
- Parameters:
- desc- describes the test that will not be run
- Throws:
- java.lang.Exception
 
 - 
testRunAbortedpublic void testRunAborted() Invoked for stop and for break originated by the user.- Overrides:
- testRunAbortedin class- ExtRunListener
 
 - 
testClassStructureLoadedpublic void testClassStructureLoaded(Description desc) Invoked if a test class is loaded defining a testsuite described bydesc.- Overrides:
- testClassStructureLoadedin class- ExtRunListener
 
 
- 
 
-