Class QuietTestOutputListener
- All Implemented Interfaces:
org.junit.platform.launcher.TestExecutionListener
System.out
and System.err and throws it away unless the test fails. Tests that
intentionally trigger logging, such as the ones covering error handling, thus
no longer flood the build output, while everything a failing test logged is
printed as usual.
Output logged through java.util.logging is not captured, since its
handlers keep writing to the stream they were created with; configure the
logger levels instead when such output is too noisy.
Replacing System.out and System.err affects the whole JVM, so
this only works when tests run one at a time. Surefire runs the unit tests
sequentially; do not enable it for tests that run in parallel, such as the
TestBench integration tests run by Failsafe, where whichever test happens to
be running would capture, and on success discard, the output of the others.
Should tests nevertheless start on more than one thread, the capture gives up
for the rest of the run instead of mixing up their output.
Registered automatically via ServiceLoader in
META-INF/services/org.junit.platform.launcher.TestExecutionListener
and enabled by the "vaadin.test.quietOutput" system property, which Surefire
sets for unit tests. Run with -Dvaadin.test.quietOutput=false to see
the output of passing tests again.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the system property that enables the capture. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecutionFinished(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult) voidexecutionStarted(org.junit.platform.launcher.TestIdentifier testIdentifier) voidtestPlanExecutionFinished(org.junit.platform.launcher.TestPlan testPlan) voidtestPlanExecutionStarted(org.junit.platform.launcher.TestPlan testPlan) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.platform.launcher.TestExecutionListener
dynamicTestRegistered, executionSkipped, fileEntryPublished, reportingEntryPublished
-
Field Details
-
ENABLED_PROPERTY
Name of the system property that enables the capture.- See Also:
-
-
Constructor Details
-
QuietTestOutputListener
public QuietTestOutputListener()
-
-
Method Details
-
testPlanExecutionStarted
public void testPlanExecutionStarted(org.junit.platform.launcher.TestPlan testPlan) - Specified by:
testPlanExecutionStartedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
executionStarted
public void executionStarted(org.junit.platform.launcher.TestIdentifier testIdentifier) - Specified by:
executionStartedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
executionFinished
public void executionFinished(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult) - Specified by:
executionFinishedin interfaceorg.junit.platform.launcher.TestExecutionListener
-
testPlanExecutionFinished
public void testPlanExecutionFinished(org.junit.platform.launcher.TestPlan testPlan) - Specified by:
testPlanExecutionFinishedin interfaceorg.junit.platform.launcher.TestExecutionListener
-