Skip to content

Undeprecate execute(TestPlan, ...) and execute(LauncherDiscoveryRequest, ...) in Launcher API #4866

@sbrannen

Description

@sbrannen

Overview

In commit f6f1a70, Launcher.execute(TestPlan, TestExecutionListener[]) and Launcher.execute(LauncherDiscoveryRequest, TestExecutionListener[]) were officially deprecated in favor of the new Launcher.execute(LauncherExecutionRequest) variant which requires a LauncherExecutionRequest.

However, given a LauncherDiscoveryRequest discoveryRequest, code like the following which has worked for years...

launcher.execute(discoveryRequest);

... must now be migrated to something like the following in order to avoid deprecation warnings (which can fail builds, depending on developer preferences).

LauncherExecutionRequest executionRequest =
    LauncherExecutionRequestBuilder.request(discoveryRequest).build();

launcher.execute(executionRequest);

That is unfortunate, since it requires developers to modify working code in a fashion that is more complex than it should be.

As of #4865, that can alternatively be implemented as follows with a static import for LauncherExecutionRequestBuilder.executionRequest.

launcher.execute(executionRequest(discoveryRequest).build());

That is effectively still a single line of code and remains rather readable (despite the need to invoke .build()); however, I think we would be doing the community a big favor by undeprecating Launcher.execute(TestPlan, TestExecutionListener[]) and Launcher.execute(LauncherDiscoveryRequest, TestExecutionListener[]).

Developers will still need to interact with a LauncherExecutionRequest for more advanced use cases (like registering a CancellationToken), but such uses cases are less common.

Related Issues

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions