Skip to content

Conversation

marcphilipp
Copy link
Member

Overview

The new Launcher.execute(LauncherExecutionRequest) method paves the
road for adding additional parameters to test execution without having
to add additional overloads of execute(). For example, for #1880
we will likely need to introduce a CancellationToken (as drafted
in #4709). Instead of having to add two new overloads, such changes will
then be easy because only LauncherExecutionRequest will need to be
changed.

LauncherExecutionRequestBuilder provides a fluent API for constructing
execution requests starting either with a TestPlan or a
LauncherDiscoveryRequest. In addition,
LauncherDiscoveryRequestBuilder.forExecution() is a convenience method
to create an execution request from a discovery request.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

The new `Launcher.execute(LauncherExecutionRequest)` method paves the
road for adding additional parameters to test execution without having
to add additional overloads of `execute()`. For example, for #1880
we will likely need to introduce a `CancellationToken` (as drafted
in #4709). Instead of having to add two new overloads, such changes will
then be easy because only `LauncherExecutionRequest` will need to be
changed.

`LauncherExecutionRequestBuilder` provides a fluent API for constructing
execution requests starting either with a `TestPlan` or a
`LauncherDiscoveryRequest`. In addition,
`LauncherDiscoveryRequestBuilder.forExecution()` is a convenience method
to create an execution request from a discovery request.
* @since 6.0
*/
@API(status = EXPERIMENTAL, since = "6.0")
public LauncherExecutionRequestBuilder forExecution() {
Copy link
Member

@sormuras sormuras Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following would be canonical, but also a mouthful:

	public LauncherExecutionRequestBuilder toLauncherExecutionRequestBuilder() {

I think, that forExecution is a good-enough abbreviation here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another variant could be:

public LauncherExecutionRequest toLauncherExecutionRequest(UnaryOperator<LauncherExecutionRequestBuilder> operator) {
  return operator.apply(LauncherExecutionRequestBuilder.request(build())).build();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this to our list of topics for the next team meeting. 👍

@marcphilipp marcphilipp merged commit f6f1a70 into main Jul 7, 2025
14 checks passed
@marcphilipp marcphilipp deleted the marc/launcher-execution-request branch July 7, 2025 10:33
@github-project-automation github-project-automation bot moved this from In Review to Done in Sovereign Tech Fund Jul 7, 2025
sbrannen added a commit that referenced this pull request Aug 25, 2025
This commit undeprecates the execute(TestPlan, ...) and
execute(LauncherDiscoveryRequest, ...) methods in the Launcher API.

See #4724
Closes #4866
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants