EngineTestKit provides support for discovering and executing tests
for a given TestEngine and provides convenient access to the results.
For discovery, EngineDiscoveryResults provides access to
the TestDescriptor of the engine and any DiscoveryIssues that were encountered.
For execution, EngineExecutionResults provides a fluent
API to verify the expected results.
engine(String), engine(TestEngine), discover(String, LauncherDiscoveryRequest), discover(TestEngine, LauncherDiscoveryRequest), execute(String, LauncherDiscoveryRequest), execute(TestEngine, LauncherDiscoveryRequest), EngineDiscoveryResults, EngineExecutionResults
| Modifier and Type | Class and Description |
|---|---|
| public static class | EngineTestKit.
|
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static EngineDiscoveryResults | Returns: the results of the discoverythe ID of the engineId, LauncherDiscoveryRequest TestEngine to use; must not be
null or blankthe discoveryRequest)LauncherDiscoveryRequest to useDiscover tests for the given The |
| public static EngineDiscoveryResults | Returns: the recordedEngineExecutionResultsthe testEngine, LauncherDiscoveryRequest TestEngine to use; must not be nullthe discoveryRequest)EngineDiscoveryResults to use; must
not be nullDiscover tests for the given |
| private static LauncherDiscoveryResult | |
| public static EngineTestKit. | Returns: the engine executionBuilderthe ID of the engineId)TestEngine to use; must not be
null or blankCreate an execution The |
| public static EngineTestKit. | Returns: the engine executionBuilderthe testEngine)TestEngine to use; must not be nullCreate an execution |
| public static EngineExecutionResults | Returns: the results of the executionthe ID of the engineId, LauncherDiscoveryRequest TestEngine to use; must not be
null or blankthe discoveryRequest)LauncherDiscoveryRequest to useExecute tests for the given The |
| public static EngineExecutionResults | Returns: the recordedEngineExecutionResultsthe testEngine, LauncherDiscoveryRequest TestEngine to use; must not be nullthe discoveryRequest)LauncherDiscoveryRequest to use; must
not be nullExecute tests for the given |
| private static void | executeUsingLauncherOrchestration(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest, EngineExecutionListener listener, CancellationToken cancellationToken)
|
| private static TestEngine | |
| private static NamespacedHierarchicalStore | |
| private static void |
| EngineTestKit | back to summary |
|---|---|
| private EngineTestKit() | |
| discover | back to summary |
|---|---|
| public static EngineDiscoveryResults discover(String engineId, LauncherDiscoveryRequest discoveryRequest) Discover tests for the given The
| |
| discover | back to summary |
|---|---|
| public static EngineDiscoveryResults discover(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest) Discover tests for the given
| |
| discoverUsingOrchestrator | back to summary |
|---|---|
| private static LauncherDiscoveryResult discoverUsingOrchestrator(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest) | |
| engine | back to summary |
|---|---|
| public static EngineTestKit. Create an execution The Example Usage
EngineTestKit
.engine("junit-jupiter")
.selectors(selectClass(MyTests.class))
.execute()
.testEvents()
.assertStatistics(stats -> stats.started(2).finished(2));
| |
| engine | back to summary |
|---|---|
| public static EngineTestKit. Create an execution Example Usage
EngineTestKit
.engine(new MyTestEngine())
.selectors(selectClass(MyTests.class))
.execute()
.testEvents()
.assertStatistics(stats -> stats.started(2).finished(2));
| |
| execute | back to summary |
|---|---|
| public static EngineExecutionResults execute(String engineId, LauncherDiscoveryRequest discoveryRequest) Execute tests for the given The
| |
| execute | back to summary |
|---|---|
| public static EngineExecutionResults execute(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest) Execute tests for the given
| |
| executeUsingLauncherOrchestration | back to summary |
|---|---|
| private static void executeUsingLauncherOrchestration(TestEngine testEngine, LauncherDiscoveryRequest discoveryRequest, EngineExecutionListener listener, CancellationToken cancellationToken) | |
| loadTestEngine | back to summary |
|---|---|
private static TestEngine loadTestEngine(String engineId)
| |
| newStore | back to summary |
|---|---|
| private static NamespacedHierarchicalStore | |
| withRequestLevelStore | back to summary |
|---|---|
| private static void withRequestLevelStore(Consumer<NamespacedHierarchicalStore<Namespace>> action) | |
TestEngine execution builder.
See EngineTestKit#engine(String) and
EngineTestKit#engine(TestEngine) for example usage.
selectors(DiscoverySelector...) , filters(Filter...) , configurationParameter(String, String), configurationParameters(Map), execute()
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private @Nullable CancellationToken | |
| private final LauncherDiscoveryRequestBuilder | |
| private final TestEngine |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public EngineTestKit. | Returns: this builder for method chainingthe cancellation token to use; never
cancellationToken)nullSet the |
| public EngineTestKit. | Returns: this builder for method chainingthe configuration parameter key under which to store the
value; never key, String null or blankthe value to store value)Add the supplied configuration parameter. |
| public EngineTestKit. | Returns: this builder for method chainingthe map of configuration parameters to add;
never configurationParameters)nullAdd all of the supplied configuration parameters. |
| public EngineDiscoveryResults | Returns: the recordedEngineDiscoveryResultsDiscover tests for the configured |
| public EngineTestKit. | enableImplicitConfigurationParameters(boolean enabled)
Configure whether implicit configuration parameters should be considered. |
| public EngineExecutionResults | Returns: the recordedEngineExecutionResultsExecute tests for the configured |
| public EngineTestKit. | |
| public EngineTestKit. | Returns: this builder for method chainingthe output directory creator to use;
never outputDirectoryCreator)nullSet the |
| public EngineTestKit. | Returns: this builder for method chainingthe output directory provider to use;
never outputDirectoryProvider)null
Deprecated
for removal since 1.14. Please use
outputDirectoryCreator(OutputDirectoryCreator) instead
Set the
|
| public EngineTestKit. | Returns: this builder for method chainingthe discovery selectors to add; never selectors)nullAdd all of the supplied discovery selectors. |
| public EngineTestKit. | Returns: this builder for method chainingthe discovery selectors to add; never selectors)nullAdd all of the supplied discovery selectors. |
| cancellationToken | back to summary |
|---|---|
| private @Nullable CancellationToken cancellationToken | |
| requestBuilder | back to summary |
|---|---|
| private final LauncherDiscoveryRequestBuilder requestBuilder | |
| testEngine | back to summary |
|---|---|
| private final TestEngine testEngine | |
| Builder | back to summary |
|---|---|
| private Builder(TestEngine testEngine) | |
| cancellationToken | back to summary |
|---|---|
| public EngineTestKit. Set the
| |
| configurationParameter | back to summary |
|---|---|
| public EngineTestKit. Add the supplied configuration parameter.
| |
| configurationParameters | back to summary |
|---|---|
| public EngineTestKit. Add all of the supplied configuration parameters.
| |
| discover | back to summary |
|---|---|
| public EngineDiscoveryResults discover() Discover tests for the configured
| |
| enableImplicitConfigurationParameters | back to summary |
|---|---|
| public EngineTestKit. Configure whether implicit configuration parameters should be considered. By default, only configuration parameters that are passed
explicitly to this builder are taken into account. Passing
| |
| execute | back to summary |
|---|---|
| public EngineExecutionResults execute() Execute tests for the configured
| |
| filters | back to summary |
|---|---|
| public EngineTestKit. Add all of the supplied filters. Built-in discovery filters can be created via the static factory
methods in Built-in post-discovery filters can be created via the static
factory methods in
| |
| outputDirectoryCreator | back to summary |
|---|---|
| public EngineTestKit. Set the If not specified, a default implementation will be used that throws an exception when attempting to create output directories. This is done to avoid accidentally writing output files to the file system.
| |
| outputDirectoryProvider | back to summary |
|---|---|
| public EngineTestKit. Set the
If not specified, a default provider will be used that throws an exception when attempting to create output directories. This is done to avoid accidentally writing output files to the file system.
| |
| selectors | back to summary |
|---|---|
| public EngineTestKit. Add all of the supplied discovery selectors. Built-in discovery selectors can be created via the static factory
methods in
| |
| selectors | back to summary |
|---|---|
| public EngineTestKit. Add all of the supplied discovery selectors. Built-in discovery selectors can be created via the static factory
methods in
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final OutputDirectoryCreator |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Path | createOutputDirectory(TestDescriptor testDescriptor)
Implements org. Create an output directory for the supplied test descriptor. |
| public Path | getRootDirectory()
Implements org. Returns the root directory for all output files; never |
| FAILURE_MESSAGE | back to summary |
|---|---|
| private static final String FAILURE_MESSAGE | |
| INSTANCE | back to summary |
|---|---|
| private static final OutputDirectoryCreator INSTANCE | |
| DisabledOutputDirectoryCreator | back to summary |
|---|---|
| private DisabledOutputDirectoryCreator() | |
| createOutputDirectory | back to summary |
|---|---|
| public Path createOutputDirectory(TestDescriptor testDescriptor) Implements org. Doc from org. Create an output directory for the supplied test descriptor.
| |
| getRootDirectory | back to summary |
|---|---|
| public Path getRootDirectory() Implements org. Doc from org. Returns the root directory for all output files; never
| |