Interface EngineExecutionListener
-
@API(status=STABLE, since="1.0") public interface EngineExecutionListenerListener to be notified of test execution events by test engines.Contrary to JUnit 4, test engines must report events not only for test descriptors that represent executable leaves but also for all intermediate containers.
- Since:
- 1.0
- See Also:
TestEngine,ExecutionRequest
-
-
Field Summary
Fields Modifier and Type Field Description static EngineExecutionListenerNOOPNo-op implementation ofEngineExecutionListener
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voiddynamicTestRegistered(TestDescriptor testDescriptor)Must be called when a new, dynamicTestDescriptorhas been registered.default voidexecutionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult)Must be called when the execution of a leaf or subtree of the test tree has finished, regardless of the outcome.default voidexecutionSkipped(TestDescriptor testDescriptor, java.lang.String reason)Must be called when the execution of a leaf or subtree of the test tree has been skipped.default voidexecutionStarted(TestDescriptor testDescriptor)Must be called when the execution of a leaf or subtree of the test tree is about to be started.default voidreportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry)Can be called for anyTestDescriptorin order to publish additional information to the reporting infrastructure — for example: Output that would otherwise go toSystem.outInformation about test context or test data
-
-
-
Field Detail
-
NOOP
static final EngineExecutionListener NOOP
No-op implementation ofEngineExecutionListener
-
-
Method Detail
-
dynamicTestRegistered
default void dynamicTestRegistered(TestDescriptor testDescriptor)
Must be called when a new, dynamicTestDescriptorhas been registered.A dynamic test is a test that is not known a-priori and therefore was not present in the test tree when discovering tests.
- Parameters:
testDescriptor- the descriptor of the newly registered test or container
-
executionSkipped
default void executionSkipped(TestDescriptor testDescriptor, java.lang.String reason)
Must be called when the execution of a leaf or subtree of the test tree has been skipped.The
TestDescriptormay represent a test or a container. In the case of a container, engines must not fire any additional events for its descendants.A skipped test or subtree of tests must not be reported as started or finished.
- Parameters:
testDescriptor- the descriptor of the skipped test or containerreason- a human-readable message describing why the execution has been skipped
-
executionStarted
default void executionStarted(TestDescriptor testDescriptor)
Must be called when the execution of a leaf or subtree of the test tree is about to be started.The
TestDescriptormay represent a test or a container. In the case of a container, engines have to fire additional events for its children.This method may only be called if the test or container has not been skipped.
This method must be called for a container
TestDescriptorbefore starting or skipping any of its children.- Parameters:
testDescriptor- the descriptor of the started test or container
-
executionFinished
default void executionFinished(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult)
Must be called when the execution of a leaf or subtree of the test tree has finished, regardless of the outcome.The
TestDescriptormay represent a test or a container.This method may only be called if the test or container has not been skipped.
This method must be called for a container
TestIdentifierafter all of its children have been skipped or have finished.The
TestExecutionResultdescribes the result of the execution for the suppliedtestDescriptor. The result does not include or aggregate the results of its children. For example, a container with a failing test must be reported asSUCCESSFULeven if one or more of its children are reported asFAILED.- Parameters:
testDescriptor- the descriptor of the finished test or containertestExecutionResult- the (unaggregated) result of the execution for the suppliedTestDescriptor- See Also:
TestExecutionResult
-
reportingEntryPublished
default void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry)
Can be called for anyTestDescriptorin order to publish additional information to the reporting infrastructure — for example:- Output that would otherwise go to
System.out - Information about test context or test data
The current lifecycle state of the supplied
TestDescriptoris not relevant: reporting events can occur at any time.- Parameters:
testDescriptor- the descriptor of the test or container to which the reporting entry belongsentry- aReportEntryinstance to be published
- Output that would otherwise go to
-
-