Skip to content
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

Cannot stop JUnit 5 tests execution #832

Closed
trancexpress opened this issue Oct 27, 2023 · 8 comments
Closed

Cannot stop JUnit 5 tests execution #832

trancexpress opened this issue Oct 27, 2023 · 8 comments

Comments

@trancexpress
Copy link
Contributor

To reproduce, run a JUnit 5 test case and try to stop the tests execution via the JUnit view stop button. E.g. import the project from the attached archive: TestJunit5Abort.zip

See also this screen recording:

ScreenRecordingJunit5Abort.mp4

Judging from this, maybe its not possible to stop the JUnit 5 tests using JUnit 5 API? junit-team/junit5#1880

@iloveeclipse
Copy link
Member

@SarikaSinha : any ideas here?
It is surprising for me to see such a basic feature is not implemented (if that is junit-team/junit5#1880), but might be we can have some workaround in the IDE?

@trancexpress : not sure it belongs to PDE, is there a reason you didn't reported it for jdt.ui?

@SarikaSinha
Copy link
Contributor

Yes, I have observed it. We can terminate from Console only.

@laeubi
Copy link
Contributor

laeubi commented Oct 30, 2023

I'm not sure if it is really related to JUnit5, but also noticed in the past that sometimes if I'm debugging a test and terminate it there, JUnit still thinks it is alive or if I terminate it on JUnit side the Debugging session still persistst, so I can second @SarikaSinha that usually killing the test from console view works best...

@mickaelistria
Copy link
Contributor

+1, it's been that way forever as far as I recall. IIRC, I had started to investigate that many years ago, and the difference in that the Debug view calls stop on the debug target, which the console view calls destroy on the process. On would expect that stopping the debug target manually would cascade to destroying the process, but it's not the case here.

@iloveeclipse
Copy link
Member

+1 to what? To current behavior?

@mickaelistria
Copy link
Contributor

+1 as an ambiguous intent to tell "I notice this behavior too and interpret it as an issue".

@trancexpress
Copy link
Contributor Author

trancexpress commented Oct 30, 2023

@trancexpress : not sure it belongs to PDE, is there a reason you didn't reported it for jdt.ui?

I'm not sure either, JDT UI prints this on the standard in (or socket) of the launched process: >STOP (see org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient.stopTest())

I'm yet to find where this is handled. I assume the launched process, and so PDE. I'm not sure though.

Relevant stack trace when launching JUnit 5 tests is more or less:

        at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:60)
        at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
        at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:74)
        at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:45)
        at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$$Lambda$865/0x0000000800e4aa30.run(Unknown Source)

The handling for the stop should be in org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.ReaderThread, so moving this to JDT UI.

@trancexpress
Copy link
Contributor Author

Please continue discussion on: eclipse-jdt/eclipse.jdt.ui#889

@trancexpress trancexpress closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants