Repository navigation
Use junit platform runner to run junit 3, junit 4 and TestNG tests via vintage engine and testng engine - #3179
Conversation
d33aa4f to
8cf2396
Compare
8030098 to
cf3793d
Compare
|
@olamy I did not see any positiv contribution from your site, only removals in favor of JUnit5. |
I assume you mean the "JUnit5 team"; the people behind the project. Right? If yes, we had "that time" and still have today more than "one tendency". We provided and still provide help, options, and alternatives for many tool authors and vendors to adopt to the (then new) JUnit Platform. Nothing changed there, we still do it happily and will do so in the foreseeable future. Are you mixing up the junit-platform-surefire-provider provided by the team (to support Surefire!) and my junit-platform-maven-plugin which was attempt to create Maven plugin talking directly to the JUnit Platform and playing nice with Java modules?
"corrupted"? The prefixed "maybe" doesn't make it sound any better. While all participants should adhere to this code of conduct, we recognize that sometimes people may have a bad day, or be unaware of some of the code's guidelines. When that happens, you may reply to them and point out this code of conduct. |
|
@Tibor17 : it has been reminded a few times that peoples who need JUnit 3 can stay on old versions of Surefire plugin. I have not seen a counter-argument to that. I have not seen neither a counter-argument to the fact that supporting JUnit 3 is an impediment to the development of new features. To recap:
|
|
Please note Junit3 code can be still executed but need the junit 4.12 dependency at least |
|
Just to point out: according to the JUnit 6 release notes, the JUnit Vintage engine is deprecated and (to quote) "it should only be used temporarily while migrating tests to JUnit Jupiter or another testing framework with native JUnit Platform support". What would the ramifications be for Surefire users that still use JUnit 3/4 tests if this change goes through & then later the JUnit folks decide to abruptly drop the JUnit Vintage engine in a future JUnit release? |
You will have a few ways to go about this:
|
It's deprecated, but not for removal. Not slowly, not abruptly, not "everly". We think of it more as we do of JUnit 3 and 4: they are here to stay. Until the last user vanishes. So does the glue-code in Not discussed with the team, yet, but I could think of moving the junit-vintage-engine module as sibling right next to the testng-engine project, making it a standalone top-level project. |
25422ec to
f4e4c92
Compare
|
TestNG contributor here – and apologies if this isn't the right place to discuss this. I believe this move could be positive for the Java community. While JUnit versions prior to 5 and TestNG are largely in maintenance mode today, the JUnit 5 platform has clearly become the most mature and actively maintained solution for testing in the Java ecosystem. From that perspective, moving the abstraction level from Maven to JUnit itself does make sense. That said, I think @Tibor17 's concerns and experience are important. For a change of this importance, a more incremental approach may be worth considering if there is a risk of breaking existing setups. Based on my understanding, the testng-engine does not yet cover all TestNG features and still sees relatively limited adoption, which may increase the migration risk. For example, would it be possible to keep the JUnit 5 provider enabled by default while disabling legacy providers, but still allow running both side by side during a transition phase? |
|
@juherr please note version 3.6.x (at least first alphas/betas/Mx whatever name we use) will be anything but only multi providers simplification (no new features at least for few version) regarding
you will be able to eventually do something such There will be some backward compatibility for the providers but maybe not for long. |
|
@olamy Yes, that is exactly what I had in mind as a transitional step. The idea is simply to allow users to upgrade Surefire while keeping a lightweight fallback option in case issues are discovered during the migration. I agree that rolling back to the previous plugin version is also a valid workaround, so this is more about flexibility than a hard requirement. And yes, I fully agree regarding testng-engine and I’m confident the team would react quickly if issues are reported. Thanks for the clarification, and looking forward to 3.6.x. |
Signed-off-by: Olivier Lamy <olamy@apache.org>
…ed provider Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
… working Signed-off-by: Olivier Lamy <olamy@apache.org>
506333f to
cf4ac96
Compare
| // Determine the target class name based on stack trace or reportEntryName | ||
| String targetClassName = extractTestClassFromStack(reportEntry.getStack()); | ||
| if (targetClassName == null) { | ||
| targetClassName = reportEntryName; |
There was a problem hiding this comment.
@olamy , we have tested the Develocity Maven extension against the latest surefire 3.6.0 snapshot that includes your changes. This piece of code causes some trouble for Test Distribution and Predictive Test Selection. Unless I am missing something, the reportEntryName is accessed but never set. So, the output without stack traces is not attributed to the correct output file. You probably need to set it in the testSetStarting and reset it in the testSetCompleted.
There was a problem hiding this comment.
@pshevche thanks for testing!
Would you mind creating an issue for this or this will be most
There was a problem hiding this comment.
Sounds good, documented it here: #3315
…s networking (#3467) ForkedBooter#setupBooter read the booter properties file through java.nio.file.Files before it applied the effective system properties. On every platform that path initializes sun.nio.ch.IOUtil, whose static initializer loads the native "net" library; libnet's JNI_OnLoad reads java.net.preferIPv4Stack once and caches the result in ipv6_available. Any value coming from systemPropertyVariables therefore arrived too late and was silently ignored, and the fork kept running on the IPv6 stack. The nio call was introduced in 3.6.0 (0c24343, #3179), which replaced FileInputStream with Files.newInputStream; before that no java.nio channel was touched during boot and the property took effect. Apply the effective system properties as the very first statement of setupBooter and read the booter properties file with FileInputStream again, so the ordering guarantee does not depend on which java.io/java.nio API a later change happens to pick. Note that Windows cannot be fixed this way: sun.nio.fs.WindowsNativeDispatcher loads "net" itself ("nio.dll has dependency on net.dll") and any jar on the class path triggers it during JVM start-up, before main. The new integration test is skipped there. Co-authored-by: Jose Luis Lopez Lopez <jllopez@isdefe.es> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Since apache/maven-surefire#3179 Surefire uses the JUnit Platform for JUnit 4, JUnit Jupiter. TestNG must be run through the `testng-engine` adaptor so there is little reason to continue using TestNG. Additionally, I'm part of the JUnit Team, so I should eat my own dogfood.
Since apache/maven-surefire#3179 Surefire uses the JUnit Platform for JUnit 4 and JUnit Jupiter. TestNG must be run through the `testng-engine` adapter so there is little reason to continue using TestNG. Additionally, I'm part of the JUnit Team, so I should eat my own dogfood.
Overview / Goal
Major Changes
There may be compatibility issues or subtle behavior changes when running JUnit 4 or TestNG tests under the new infrastructure (e.g. differences in how filters, groups, or lifecycle behaviors are handled).
The change consolidates execution under the JUnit Platform, which could simplify the runner architecture