-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Introduce LauncherExecutionRequest
#4724
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
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() { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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();
}
There was a problem hiding this comment.
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. 👍
Overview
The new
Launcher.execute(LauncherExecutionRequest)
method paves theroad for adding additional parameters to test execution without having
to add additional overloads of
execute()
. For example, for #1880we will likely need to introduce a
CancellationToken
(as draftedin #4709). Instead of having to add two new overloads, such changes will
then be easy because only
LauncherExecutionRequest
will need to bechanged.
LauncherExecutionRequestBuilder
provides a fluent API for constructingexecution requests starting either with a
TestPlan
or aLauncherDiscoveryRequest
. In addition,LauncherDiscoveryRequestBuilder.forExecution()
is a convenience methodto create an execution request from a discovery request.
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations