Top Description Fields Methods
org.junit.platform.engine

public Interface EngineExecutionListener

Annotations
@API
status:STABLE
since:1.0
Static Imports
org.apiguardian.api.API.Status.STABLE

Listener 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

Modifier and TypeField and Description
public static final EngineExecutionListener
NOOP

No-op implementation of EngineExecutionListener

Method Summary

Modifier and TypeMethod and Description
public default void
dynamicTestRegistered(TestDescriptor
the descriptor of the newly registered test or container
testDescriptor
)

Must be called when a new, dynamic TestDescriptor has been registered.

public default void
executionFinished(TestDescriptor
the descriptor of the finished test or container
testDescriptor
,
TestExecutionResult
the (unaggregated) result of the execution for the supplied TestDescriptor
testExecutionResult
)

Must be called when the execution of a leaf or subtree of the test tree has finished, regardless of the outcome.

public default void
executionSkipped(TestDescriptor
the descriptor of the skipped test or container
testDescriptor
,
String
a human-readable message describing why the execution has been skipped
reason
)

Must be called when the execution of a leaf or subtree of the test tree has been skipped.

public default void
executionStarted(TestDescriptor
the descriptor of the started test or container
testDescriptor
)

Must be called when the execution of a leaf or subtree of the test tree is about to be started.

public default void
reportingEntryPublished(TestDescriptor
the descriptor of the test or container to which the reporting entry belongs
testDescriptor
,
ReportEntry
a ReportEntry instance to be published
entry
)

Can be called for any TestDescriptor in 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

Field Detail

NOOPback to summary
public static final EngineExecutionListener NOOP

No-op implementation of EngineExecutionListener

Method Detail

dynamicTestRegisteredback to summary
public default void dynamicTestRegistered(TestDescriptor testDescriptor)

Must be called when a new, dynamic TestDescriptor has 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:TestDescriptor

the descriptor of the newly registered test or container

executionFinishedback to summary
public 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 TestDescriptor may 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 TestIdentifier after all of its children have been skipped or have finished.

The TestExecutionResult describes the result of the execution for the supplied testDescriptor. The result does not include or aggregate the results of its children. For example, a container with a failing test must be reported as SUCCESSFUL even if one or more of its children are reported as FAILED.

Parameters
testDescriptor:TestDescriptor

the descriptor of the finished test or container

testExecutionResult:TestExecutionResult

the (unaggregated) result of the execution for the supplied TestDescriptor

See Also
TestExecutionResult
executionSkippedback to summary
public default void executionSkipped(TestDescriptor testDescriptor, String reason)

Must be called when the execution of a leaf or subtree of the test tree has been skipped.

The TestDescriptor may 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:TestDescriptor

the descriptor of the skipped test or container

reason:String

a human-readable message describing why the execution has been skipped

executionStartedback to summary
public 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 TestDescriptor may 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 TestDescriptor before starting or skipping any of its children.

Parameters
testDescriptor:TestDescriptor

the descriptor of the started test or container

reportingEntryPublishedback to summary
public default void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry)

Can be called for any TestDescriptor in 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 TestDescriptor is not relevant: reporting events can occur at any time.

Parameters
testDescriptor:TestDescriptor

the descriptor of the test or container to which the reporting entry belongs

entry:ReportEntry

a ReportEntry instance to be published