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 and for ensuring that
each test engine has an
ID that is unique
among the registered test engines. For example, the default implementation
returned by org.
dynamically discovers test engines via Java's ServiceLoader mechanism.
Test discovery and execution require a LauncherDiscoveryRequest
that is passed to all registered engines. Each engine decides which tests it
can discover and execute according to the supplied request.
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. The default implementation
returned by org.
dynamically discovers test execution listeners via Java's
ServiceLoader mechanism.
LauncherDiscoveryRequest, TestPlan, TestExecutionListener, org.junit.platform.launcher.core.LauncherFactory , org.junit.platform.engine.TestEngine
| Modifier and Type | Method and Description |
|---|---|
| public TestPlan | Returns: an unmodifiableTestPlan that contains all resolved
identifiers from all registered enginesthe launcher discovery request; never discoveryRequest)nullDiscover tests and build a |
| public void | execute(LauncherDiscoveryRequest
the launcher discovery request; never discoveryRequest, TestExecutionListener... nulladditional test execution listeners; never listeners)nullExecute a |
| public void | execute(TestPlan
the test plan to execute; never testPlan, TestExecutionListener... nulladditional test execution listeners; never listeners)nullExecute the supplied |
| public void | execute(LauncherExecutionRequest
the launcher execution request; never executionRequest)nullExecute tests according to the supplied |
| public void | registerLauncherDiscoveryListeners(LauncherDiscoveryListener...
the listeners to be notified of test discovery events;
never listeners)null or emptyRegister one or more listeners for test discovery. |
| public void | registerTestExecutionListeners(TestExecutionListener...
the listeners to be notified of test execution events;
never listeners)null or emptyRegister one or more listeners for test execution. |
| discover | back to summary |
|---|---|
| public TestPlan discover(LauncherDiscoveryRequest discoveryRequest) Discover tests and build a API Note This method may be called to generate a preview of the test
tree. The resulting
| |
| execute | back to summary |
|---|---|
| public void execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... listeners) Execute a Supplied test execution listeners are registered in addition to already registered listeners but only for the supplied launcher discovery request. API Note Calling this method will cause test discovery to be executed for
all registered engines. If the same
| |
| execute | back to summary |
|---|---|
| public void execute(TestPlan testPlan, TestExecutionListener... listeners) Execute the supplied Supplied test execution listeners are registered in addition to already registered listeners but only for the execution of the supplied test plan. API Note The supplied
| |
| execute | back to summary |
|---|---|
| public void execute(LauncherExecutionRequest executionRequest) Execute tests according to the supplied Test execution listeners supplied as part of the request are registered in addition to already registered listeners but only for the supplied execution request. API Note If the execution request contains a If the execution request contains a
| |
| registerLauncherDiscoveryListeners | back to summary |
|---|---|
| public void registerLauncherDiscoveryListeners(LauncherDiscoveryListener... listeners) Register one or more listeners for test discovery.
| |
| registerTestExecutionListeners | back to summary |
|---|---|
| public void registerTestExecutionListeners(TestExecutionListener... listeners) Register one or more listeners for test execution.
| |