@API(value=Experimental)
public interface Launcher
Launcher API is the main entry point for client code that
wishes to discover and execute tests using one or more
test engines.
Implementations of this interface are responsible for determining
the set of test engines to delegate to at runtime. For example, the
default implementation as returned by
LauncherFactory.create()
dynamically registers test engines via Java's
ServiceLoader mechanism.
Discovery and execution of tests require a TestDiscoveryRequest
which is passed to all registered engines. Each engine decides which tests
it can discover and later execute according to the TestDiscoveryRequest.
Clients of this interface may optionally call discover(org.junit.gen5.launcher.TestDiscoveryRequest) prior to
execute(org.junit.gen5.launcher.TestDiscoveryRequest) in order to inspect the TestPlan before executing
it.
Prior to executing tests, clients of this interface should
register one or more
TestExecutionListener instances in order to get feedback about the
progress and results of test execution. Listeners will be notified of events
in the order in which they were registered.
TestDiscoveryRequest,
TestPlan,
TestExecutionListener,
LauncherFactory,
TestEngine| Modifier and Type | Method and Description |
|---|---|
TestPlan |
discover(TestDiscoveryRequest testDiscoveryRequest)
Discover tests and build a
TestPlan according to the supplied
TestDiscoveryRequest by querying all registered engines and
collecting their results. |
void |
execute(TestDiscoveryRequest testDiscoveryRequest)
Execute a
TestPlan which is built according to the supplied
TestDiscoveryRequest by querying all registered engines and
collecting their results, and notify registered listeners about the progress and results of the execution. |
void |
registerTestExecutionListeners(TestExecutionListener... listeners)
Register one or more listeners for test execution.
|
void registerTestExecutionListeners(TestExecutionListener... listeners)
listeners - the listeners to be notified of test execution eventsTestPlan discover(TestDiscoveryRequest testDiscoveryRequest)
TestPlan according to the supplied
TestDiscoveryRequest by querying all registered engines and
collecting their results.testDiscoveryRequest - the test discovery requestTestPlan that contains all resolved identifiers from all registered enginesvoid execute(TestDiscoveryRequest testDiscoveryRequest)
TestPlan which is built according to the supplied
TestDiscoveryRequest by querying all registered engines and
collecting their results, and notify registered listeners about the progress and results of the execution.testDiscoveryRequest - the test discovery request