Class NonConcurrentRunListener
- java.lang.Object
-
- org.junit.runner.notification.RunListener
-
- org.apache.maven.surefire.common.junit4.JUnit4RunListener
-
- org.apache.maven.surefire.junitcore.NonConcurrentRunListener
-
- All Implemented Interfaces:
ConsoleOutputReceiver
public class NonConcurrentRunListener extends JUnit4RunListener implements ConsoleOutputReceiver
A class to be used when there is no JUnit parallelism (methods or/and class). This allow to workaround JUnit limitation a la Junit4 provider. Specifically, we can redirect properly the output even if we don't have class demarcation in JUnit. It works when if there is a JVM instance per test run, i.e. with forkMode=always or perthread.
-
-
Field Summary
Fields Modifier and Type Field Description private org.junit.runner.Description
currentTestSetDescription
private org.junit.runner.Description
lastFinishedDescription
-
Fields inherited from class org.apache.maven.surefire.common.junit4.JUnit4RunListener
reporter
-
-
Constructor Summary
Constructors Constructor Description NonConcurrentRunListener(RunListener reporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SimpleReportEntry
createReportEntry(org.junit.runner.Description description)
private TestSetReportEntry
createReportEntryForTestSet(org.junit.runner.Description description, java.util.Map<java.lang.String,java.lang.String> systemProps)
private TestSetReportEntry
createTestSetReportEntryFinished(org.junit.runner.Description description)
private TestSetReportEntry
createTestSetReportEntryStarted(org.junit.runner.Description description)
private boolean
describesNewTestSet(org.junit.runner.Description description)
private void
finishLastTestSetIfNecessary(org.junit.runner.Description description)
void
testAssumptionFailure(org.junit.runner.notification.Failure failure)
void
testFailure(org.junit.runner.notification.Failure failure)
Called when a specific test has failed.void
testFinished(org.junit.runner.Description description)
Called after a specific test has finished.void
testIgnored(org.junit.runner.Description description)
Called when a specific test has been skipped (for whatever reason).void
testRunFinished(org.junit.runner.Result result)
void
testRunStarted(org.junit.runner.Description description)
void
testStarted(org.junit.runner.Description description)
Called when a specific test has started.void
writeTestOutput(java.lang.String output, boolean newLine, boolean stdout)
Forwards process output from the running test-case into the reporting system-
Methods inherited from class org.apache.maven.surefire.common.junit4.JUnit4RunListener
createStackTraceWriter, rethrowAnyTestMechanismFailures, testExecutionSkippedByUser
-
-
-
-
Constructor Detail
-
NonConcurrentRunListener
public NonConcurrentRunListener(RunListener reporter) throws TestSetFailedException
- Throws:
TestSetFailedException
-
-
Method Detail
-
writeTestOutput
public void writeTestOutput(java.lang.String output, boolean newLine, boolean stdout)
Description copied from interface:ConsoleOutputReceiver
Forwards process output from the running test-case into the reporting system- Specified by:
writeTestOutput
in interfaceConsoleOutputReceiver
- Parameters:
output
- stdout/sterr output from running testsnewLine
- print on new linestdout
- Indicates if this is stdout
-
createReportEntry
protected SimpleReportEntry createReportEntry(org.junit.runner.Description description)
- Overrides:
createReportEntry
in classJUnit4RunListener
-
createReportEntryForTestSet
private TestSetReportEntry createReportEntryForTestSet(org.junit.runner.Description description, java.util.Map<java.lang.String,java.lang.String> systemProps)
-
createTestSetReportEntryStarted
private TestSetReportEntry createTestSetReportEntryStarted(org.junit.runner.Description description)
-
createTestSetReportEntryFinished
private TestSetReportEntry createTestSetReportEntryFinished(org.junit.runner.Description description)
-
testStarted
public void testStarted(org.junit.runner.Description description) throws java.lang.Exception
Description copied from class:JUnit4RunListener
Called when a specific test has started.- Overrides:
testStarted
in classJUnit4RunListener
- Throws:
java.lang.Exception
- See Also:
RunListener.testStarted(org.junit.runner.Description)
-
finishLastTestSetIfNecessary
private void finishLastTestSetIfNecessary(org.junit.runner.Description description)
-
describesNewTestSet
private boolean describesNewTestSet(org.junit.runner.Description description)
-
testFinished
public void testFinished(org.junit.runner.Description description) throws java.lang.Exception
Description copied from class:JUnit4RunListener
Called after a specific test has finished.- Overrides:
testFinished
in classJUnit4RunListener
- Throws:
java.lang.Exception
- See Also:
RunListener.testFinished(org.junit.runner.Description)
-
testIgnored
public void testIgnored(org.junit.runner.Description description) throws java.lang.Exception
Description copied from class:JUnit4RunListener
Called when a specific test has been skipped (for whatever reason).- Overrides:
testIgnored
in classJUnit4RunListener
- Throws:
java.lang.Exception
- See Also:
RunListener.testIgnored(org.junit.runner.Description)
-
testFailure
public void testFailure(org.junit.runner.notification.Failure failure) throws java.lang.Exception
Description copied from class:JUnit4RunListener
Called when a specific test has failed.- Overrides:
testFailure
in classJUnit4RunListener
- Throws:
java.lang.Exception
- See Also:
RunListener.testFailure(org.junit.runner.notification.Failure)
-
testAssumptionFailure
public void testAssumptionFailure(org.junit.runner.notification.Failure failure)
- Overrides:
testAssumptionFailure
in classJUnit4RunListener
-
testRunStarted
public void testRunStarted(org.junit.runner.Description description) throws java.lang.Exception
- Overrides:
testRunStarted
in classorg.junit.runner.notification.RunListener
- Throws:
java.lang.Exception
-
testRunFinished
public void testRunFinished(org.junit.runner.Result result) throws java.lang.Exception
- Overrides:
testRunFinished
in classorg.junit.runner.notification.RunListener
- Throws:
java.lang.Exception
-
-