-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Introduce support for cancelling a running execution to the Launcher API #4728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
79c36ac
to
4b6c2df
Compare
This commit introduces `CancellationToken` that can be created and passed to the `Launcher` as part of a `LauncherExecutionRequest`. The `Launcher` checks whether cancellation has been requested on the token prior to asking each test engine to execute tests. If cancellation has been requested, the `Launcher` reports all direct children of engine descriptors as skipped. Moreover, it passes the `CancellationToken` to each engine so they can check and respond to cancellation as well which will be implemented separately as indicated by TODO comments. `EngineTestKit` also supports passing a `CancellationToken` to the engine under test. The documentation now contains an example for implementing a fail-fast listener and documents the additional requirement for test engines that wish to support cancellation. Resolves #1880.
4b6c2df
to
eec8df0
Compare
@marcphilipp : could you please give a hint for IDE providers:
Thanks. |
Sure!
The
6.0.0-M2 (not released yet)
To effectively cancel test execution, registered test engines will have to implement support cancellation. As you can see in the umbrella issue #4725, all engines provided by the JUnit team (Jupiter, Suites, Vintage, and TestNG) will do so and some third-party engines (most notably, Cucumber and Spock) will automatically receive support since they extend
I added a full example to the docs: https://docs.junit.org/snapshot/user-guide/#launcher-api-launcher-cancellation Please let me know if you have any concerns or questions. |
Overview
This commit introduces
CancellationToken
that can be created andpassed to the
Launcher
as part of aLauncherExecutionRequest
. TheLauncher
checks whether cancellation has been requested on the tokenprior to asking each test engine to execute tests. If cancellation has
been requested, the
Launcher
reports all direct children of enginedescriptors as skipped. Moreover, it passes the
CancellationToken
toeach engine so they can check and respond to cancellation as well which
will be implemented separately as indicated by TODO comments.
EngineTestKit
also supports passing aCancellationToken
to theengine under test.
The documentation now contains an example for implementing a fail-fast
listener and documents the additional requirement for test engines that
wish to support cancellation.
Resolves #1880.
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations