-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Introduce pleaseStop()
method for org.junit.platform.launcher.Launcher
#1880
Comments
I'd like that too. I ran into a problem that is related to this and reported to Jira. Please implement this because it would solve my problem. Also, I think I'm not the only one with this. |
I've done a little big of digging to see if it would be possible to implement this. I think it is. For the purpose of this discussion I'll be using the The protected HierarchicalTestExecutorService createExecutorService(ExecutionRequest request) {
return new SameThreadHierarchicalTestExecutorService();
} The Because the However prior to execution the For example looking at static class ExclusiveTask extends RecursiveAction {
private final TestTask testTask;
private final EngineExecutionListener listener;
@Override
public void compute() {
if (!listener.canWeContinue()){
testTask.skip(); // This would execute the test task and result in a Skipped status.
return;
}
try (ResourceLock lock = testTask.getResourceLock().acquire()) {
testTask.execute();
}
catch (InterruptedException e) {
ExceptionUtils.throwAsUncheckedException(e);
}
}
} Naming would obviously have to be improved a bit and I think the |
@mpkorstanje, thanks for investigating the feasibility of this feature. This is currently scheduled for the 5.7 backlog, so we hope to look into this during the 5.7 time frame. |
@sbrannen |
I did not say important fact that introducing an abstract method in a listener would mean breaking the backwards compatibility where the mandatory method should be implemented; otherwise the runtime with higher version of engine would throw |
If we add a new method to an existing type, it would likely be in an interface... in which case we would almost certainly introduce an interface Or did you mean something else? |
@sbrannen |
Brainstorming ideas: We discussed a few options on how the Launcher API could be extended:
|
The first idea relates to #90 - perhaps this |
Interesting that in my duplicate issue #2462, I came up with the same idea as the last one - to have an asynchronous |
This would be great for Gradle users on Windows. Right now, if you cancel a Gradle build, Gradle will shut down the test process, because there is no better API for stopping tests. On Linux/Mac this is a graceful shutdown, so you can clean things up in your tests with shutdown handlers. On Windows, the shutdown is immediate and no shutdown handlers get executed. As a result, your tests won't clean up after themselves. If we had this API, Gradle could ask it to stop this way first, allowing tests to clean up any services they started etc. |
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution. |
This issue has been automatically closed due to inactivity. If you have a good use case for this feature, please feel free to reopen the issue. |
Any news on this one? :-) |
Is there anything the community can help with this? |
Looking forward to the conclusion and updates on this issue~ |
As a next step, we should explore the ideas from #1880 (comment) further. I'm all for it if anyone wants to take a stab at this. Please be aware that it's exploratory work, though, and we might end up not merging the PR. |
This issue looks really interesting! Even if it doesn't end up getting merged, I'd love to take a shot at it. |
Issue: junit-team#1880 Signed-off-by: yongjunhong <kevin0928@naver.com>
The comment #1880 (comment) outlined two ideas, and I opted for the second approach, leveraging asynchronous execution to gracefully stop tests, as it seemed more suitable. In line with the approach taken in other issues, I split the work into multiple steps.
The object that provides methods to cancel tests includes one for Additionally, I have added a method to set the I watched a video where the JUnit team introduced new features in JUnit 5, and they mentioned the failure threshold for I thought this could be a good approach for this issue as well, so I added it. 😁 |
@YongGoose Thanks for sharing that first step! This issue is on my list for later this year (as part of the STF work). I'll need to play around with it myself a bit but I'll ask for feedback here once I have a more concrete plan. |
It's great to hear about your plans! excited to provide feedback later this year. Happy New Year! |
Thanks, you too! 🙂 |
We would like to send a command to the engine to control the execution and stop the progress of pending tests via the interface
org.junit.platform.launcher.Launcher
.The text was updated successfully, but these errors were encountered: