Skip to content

Introduce support for cancelling a running execution in Platform and engines #4725

@marcphilipp

Description

@marcphilipp

Motivation

Currently, the JUnit Platform provides no safe way to cancel test execution early, e.g. after the first test failed, although this is possible in JUnit 4. The only option is to forcibly terminate the JVM running the tests, but that will also cause cleanup operations, such as deleting temporary files or stopping Docker containers used in tests, to be skipped. Letting all tests run is often wasteful in terms of resources such as CPU and causes longer feedback cycles for developers.

Therefore, we should add a new API to the Platform to allow gracefully stopping test execution early while ensuring resources are cleaned up appropriately. We will also implement cancellation support for the core engines (Jupiter, Suite, Vintage) as well as third-party engines that extend HierarchicalTestEngine.

Finally, to ensure the new APIs can be consumed from build tools, we should submit issues or PRs to Gradle and Maven Surefire/Failsafe so users can benefit from the new functionality as soon as possible.

Deliverables

Metadata

Metadata

Assignees

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions