@API(status=MAINTAINED, since="1.0") public class LoggingListener extends Object implements TestExecutionListener
TestExecutionListener for logging informational messages
for all events via a BiConsumer that consumes Throwable
and Supplier<String>.forJavaUtilLogging(),
forJavaUtilLogging(Level),
LoggingListener(BiConsumer)| Modifier and Type | Method and Description |
|---|---|
void |
dynamicTestRegistered(TestIdentifier testIdentifier)
Called when a new, dynamic
TestIdentifier has been registered. |
void |
executionFinished(TestIdentifier testIdentifier,
TestExecutionResult testExecutionResult)
Called when the execution of a leaf or subtree of the
TestPlan
has finished, regardless of the outcome. |
void |
executionSkipped(TestIdentifier testIdentifier,
String reason)
Called when the execution of a leaf or subtree of the
TestPlan
has been skipped. |
void |
executionStarted(TestIdentifier testIdentifier)
Called when the execution of a leaf or subtree of the
TestPlan
is about to be started. |
static LoggingListener |
forBiConsumer(BiConsumer<Throwable,Supplier<String>> logger)
Create a
LoggingListener which delegates to the supplied
BiConsumer for consumption of logging messages. |
static LoggingListener |
forJavaUtilLogging()
|
static LoggingListener |
forJavaUtilLogging(Level logLevel)
|
void |
testPlanExecutionFinished(TestPlan testPlan)
Called when the execution of the
TestPlan has finished,
after all tests have been executed. |
void |
testPlanExecutionStarted(TestPlan testPlan)
Called when the execution of the
TestPlan has started,
before any test has been executed. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreportingEntryPublishedpublic static LoggingListener forJavaUtilLogging()
public static LoggingListener forJavaUtilLogging(Level logLevel)
logLevel - the log level to use; never nullforJavaUtilLogging(),
forBiConsumer(BiConsumer)public static LoggingListener forBiConsumer(BiConsumer<Throwable,Supplier<String>> logger)
LoggingListener which delegates to the supplied
BiConsumer for consumption of logging messages.
The BiConsumer's arguments are a Throwable (potentially
null) and a Supplier (never null) for the log
message.
logger - a logger implemented as a BiConsumer;
never nullforJavaUtilLogging(),
forJavaUtilLogging(Level)public void testPlanExecutionStarted(TestPlan testPlan)
TestExecutionListenerTestPlan has started,
before any test has been executed.testPlanExecutionStarted in interface TestExecutionListenertestPlan - describes the tree of tests about to be executedpublic void testPlanExecutionFinished(TestPlan testPlan)
TestExecutionListenerTestPlan has finished,
after all tests have been executed.testPlanExecutionFinished in interface TestExecutionListenertestPlan - describes the tree of tests that have been executedpublic void dynamicTestRegistered(TestIdentifier testIdentifier)
TestExecutionListenerTestIdentifier has been registered.
A dynamic test is a test that is not known a-priori and
therefore not contained in the original TestPlan.
dynamicTestRegistered in interface TestExecutionListenertestIdentifier - the identifier of the newly registered test
or containerpublic void executionStarted(TestIdentifier testIdentifier)
TestExecutionListenerTestPlan
is about to be started.
The TestIdentifier may represent a test or a container.
This method will only be called if the test or container has not been skipped.
This method will be called for a container TestIdentifier
before starting or
skipping any of its children.
executionStarted in interface TestExecutionListenertestIdentifier - the identifier of the started test or containerpublic void executionSkipped(TestIdentifier testIdentifier, String reason)
TestExecutionListenerTestPlan
has been skipped.
The TestIdentifier may represent a test or a container. In
the case of a container, no listener methods will be called for any of
its descendants.
A skipped test or subtree of tests will never be reported as started or finished.
executionSkipped in interface TestExecutionListenertestIdentifier - the identifier of the skipped test or containerreason - a human-readable message describing why the execution
has been skippedpublic void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult)
TestExecutionListenerTestPlan
has finished, regardless of the outcome.
The TestIdentifier may represent a test or a container.
This method will only be called if the test or container has not been skipped.
This method will be called for a container TestIdentifier
after all of its children have been
skipped or have
finished.
The TestExecutionResult describes the result of the execution
for the supplied TestIdentifier. The result does not include or
aggregate the results of its children. For example, a container with a
failing test will be reported as SUCCESSFUL even
if one or more of its children are reported as FAILED.
executionFinished in interface TestExecutionListenertestIdentifier - the identifier of the finished test or containertestExecutionResult - the (unaggregated) result of the execution for
the supplied TestIdentifierTestExecutionResult