-
-
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
Improve debug mode detection in JUnit Jupiter #2973
Conversation
I don't recall the details, but I believe that was not picked for a reason. It might be better to just check if one of the arguments contains That would then work for |
related discussion in #2026 (comment) |
Thanks for the feedback. I expect I'll have time to fix this up on Monday. Any input on writing tests? Or are you comfortable without? |
It appears we don't have any tests for that (at least not with the initial commit ddb8c61), so I guess it will be OK without additional tests for this particular feature. |
junit-platform-commons/src/main/java/org/junit/platform/commons/util/RuntimeUtils.java
Outdated
Show resolved
Hide resolved
@cj81499 Thanks for your contribution! 👍 |
@marcphilipp thanks for your help getting it merged! |
Overview
I'm handling an upgrade from JUnit 4 to JUnit 5 and noticed that disabling our timeouts with
-Djunit.jupiter.execution.timeout.mode=disabled_on_debug
is not working as expected.We use VSCode as our editor/IDE. When using the Debugger for Java extension to debug tests.
When ran in my project, the following "test" prints
[-ea, -Djunit.jupiter.execution.timeout.mode=disabled_on_debug, -XX:+ShowCodeDetailsInExceptionMessages, -Dfile.encoding=UTF-8]
When ran with the debugger in my project, the following "test" prints
[-Xdebug, -Xnoagent, -Djava.compiler=NONE, -Xrunjdwp:transport=dt_socket,address=localhost:34399,server=n,suspend=y, -ea, -Djunit.jupiter.execution.timeout.mode=disabled_on_debug, -XX:+ShowCodeDetailsInExceptionMessages, -Dfile.encoding=UTF-8]
Notably, the first 4 argument of the output from the run using the debugger are not present from the run without the debugger.
JUnit 4 detected
-Xdebug
as a sign of debugging, but (prior to this change) JUnit 5 does not, leading to the unexpected timeouts while debugging (and regression, compared to JUnit 4). Since JUnit 4 used it, I figured-Xdebug
was the best thing to detect.I'm not really sure how to test this kind of thing, but I'm open to suggestions.
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations