Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Use junit platform runner to run junit 3, junit 4 and TestNG tests via vintage engine and testng engine - #3179

Merged
olamy merged 210 commits into
masterfrom
test-junit-platform-runner-junit4
Mar 2, 2026
Merged

olamy merged 210 commits into
masterfrom
test-junit-platform-runner-junit4

Conversation

@olamy

@olamy olamy commented Sep 14, 2025 •

Copy link
Copy Markdown
Member

Overview / Goal

  • The PR intends to switch Surefire to use the JUnit Platform runner (i.e. the JUnit 5 infrastructure) to run JUnit 4 tests via the Vintage engine, and also support TestNG under that runner.
  • The main changes are removal support for dependency to JUnit 3, for versions of JUnit 4 older than 4.12 and testng older than 6.14.3
  • main advantage will be to have only a single implementation to maintain as listener/reporter/launcher of test running platform. Without such change there 5 implementations to maintain which makes any changes extra work which doesn't help to get new contributors to help.

Major Changes

Change Description Impact
Drop JUnit 3 provider The PR removes the “JUnit 3 provider” entirely. Junit3 code will be executed via junit vintage only need to upgrade junit dependency to 4.12 at least
Enforce minimum JUnit 4 version JUnit 4.12 becomes the minimum supported version. Versions earlier than 4.12 are no longer supported.
Route JUnit 4 tests via JUnit Platform + Vintage engine Instead of using a separate JUnit 4 runner / provider, JUnit 4 tests will be executed via the JUnit Platform infrastructure using the Vintage engine.
Integrate TestNG under JUnit Platform runner TestNG will now also be run via JUnit Platform, with mappings of TestNG configuration (groups, etc.) to the JUnit Platform infrastructure.\
Code removal / cleanup A lot of internal code for the old JUnit 3/4/47/TestNG providers is removed for simplification
Version bump / snapshot change The version is bumped to something like 3.6.0-SNAPSHOT in the PR.
Minimum TestNG version The PR also sets a minimum supported TestNG version (6.14.3)
Adaptation in existing features Some features are reworked or adapted (e.g. parallel execution, mapping of “groups” in TestNG to tags/filters, error handling in logs) so they work properly under the new runner approach.

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

@olamy
olamy force-pushed the test-junit-platform-runner-junit4 branch from d33aa4f to 8cf2396 Compare September 18, 2025 11:44
@olamy olamy changed the title [WIP] junit platform runner for all [WIP] Use junit platform runner to run junit 4 tests via vintage engine (remove support of Junit 3 and older version of 4.12) Sep 25, 2025
@olamy
olamy force-pushed the test-junit-platform-runner-junit4 branch 2 times, most recently from 8030098 to cf3793d Compare October 10, 2025 03:34
@olamy olamy changed the title [WIP] Use junit platform runner to run junit 4 tests via vintage engine (remove support of Junit 3 and older version of 4.12) [WIP] Use junit platform runner to run junit 4 tests via vintage engine and testng (remove support of Junit 3 and older version of 4.12) Oct 10, 2025
@olamy olamy added breaking Pull requests that break existing features removed Pull requests that remove features enhancement New feature or request labels Oct 10, 2025
@Tibor17
Tibor17 self-requested a review October 14, 2025 11:33
@Tibor17

Tibor17 commented Oct 14, 2025

Copy link
Copy Markdown
Contributor

@olamy I did not see any positiv contribution from your site, only removals in favor of JUnit5.
The JUnit5 had one tendency 6 years ago, it was removal of Surefire and acceptance of "their" plugin. I know it because we talked about it that time.
If you follow this approach, you would break users, you would break the default behavior.
If you think tat Surefire Provider JUnit4 and Surefire Provider JUnit4.7+ are only about the version, then you do NOT understand this project.
If you think that Surefire Provider JUnit3 is only about JUnit3 then you again do not understand the point.
I saw people who remove something because they think that the old must go away but it happens because they are maybe corrupted or they do not want to understand, they do not listen and nothing exists for them only their ambition.
So, better for you is to collaborate with people who have long experiences with this project, who have the continuity of history and not to waste the energy with commits because they are really useless.
On the sire of Surefire there was a plan and the plan had a purpose but somebody did not understand it and deleted it. Without this plan some bugs cannot be fixed. Yesterday I talked to one contributor, he made a PR few days ago, and he understood point within several minutes but it is very hard to understand for someone who want's to do arrogant commits ignoring what I am telling you some weeks.

@sormuras

Copy link
Copy Markdown
Contributor

The JUnit5 had one tendency 6 years ago, it was removal of Surefire and acceptance of "their" plugin. I know it because we talked about it that time.

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?

I saw people who remove something because they think that the old must go away but it happens because they are maybe corrupted or they do not want to understand, they do not listen and nothing exists for them only their ambition.

"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.

https://www.apache.org/foundation/policies/conduct

@desruisseaux

Copy link
Copy Markdown

@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:

  • Why users who want to stay on old JUnit versions could not stay also on old Surefire versions?
  • Considering that removing JUnit 3 support is necessary for making improvements easier, why supporting JUnit 3 in latest Surefire is more important than allowing the development of new features (multi-release support, etc.)?

@olamy

olamy commented Oct 15, 2025

Copy link
Copy Markdown
Member Author

Please note Junit3 code can be still executed but need the junit 4.12 dependency at least

@olamy olamy changed the title [WIP] Use junit platform runner to run junit 4 tests via vintage engine and testng (remove support of Junit 3 and older version of 4.12) [WIP] Use junit platform runner to run junit 3, junit 4 and TestNG tests via vintage engine and testng engine Oct 15, 2025
@norrisjeremy

norrisjeremy commented Oct 15, 2025 •

Copy link
Copy Markdown

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?

@olamy

olamy commented Oct 15, 2025

Copy link
Copy Markdown
Member Author

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:

  • Option 1: Easiest one, just stick with the last Surefire version before this PR is merged by setting it in your pluginManagement. Since you’re already on the older JUnit 3/4 (which are deprecated anyway), it’s totally fine to stay on an older Surefire for now.

  • Option 2: Surefire will pick up whatever JUnit version or platform it finds (JUnit, JUnit Platform, or JUnit Vintage) from your pom. So unless you’re moving to JUnit 6.x (or a Vintage version that dropped JUnit 3/4 support), you should be all good.

  • Option 3: If you’re thinking about updating things, you could use a tool like OpenRewrite or even an AI helper to migrate your tests to JUnit 5 or 6.

@sormuras

Copy link
Copy Markdown
Contributor

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?

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 junit-vintage-engine. As long as the JUnit Platform is supported by tools (including Maven), you get all the integration with your testing framework of choice. Through an implementation of a test engine. And in case of JUnit 3 and 4, both projects are in an end-of-life status, no change is to be expected on their side.

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.

@juherr

juherr commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

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?

@olamy

olamy commented Jan 29, 2026

Copy link
Copy Markdown
Member Author

@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)
So either you upgrade to this version or you simply keep using the previous version 3.5.x.
Not sure to understand what sort of more incremental approach could be used?

regarding

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?

you will be able to eventually do something such

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.6.xxx</version>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit3</artifactId>
            <version>3.5.4</version>
          </dependency>
        </dependencies>
     </plugin>

There will be some backward compatibility for the providers but maybe not for long.
But what would be the benefit for someone doing such configuration? (again if any issue just change back surefire plugin version)
If there is any issue with the testng-engine, I'm pretty sure the team there will be happy to fix and release any issue quickly.

@juherr

juherr commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

@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.

olamy added 6 commits March 2, 2026 21:24
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>
Signed-off-by: Olivier Lamy <olamy@apache.org>
@olamy
olamy force-pushed the test-junit-platform-runner-junit4 branch from 506333f to cf4ac96 Compare March 2, 2026 11:25
Signed-off-by: Olivier Lamy <olamy@apache.org>
@olamy
olamy merged commit 0c24343 into master Mar 2, 2026
17 of 29 checks passed
@olamy
olamy deleted the test-junit-platform-runner-junit4 branch March 2, 2026 23:04
@olamy
olamy restored the test-junit-platform-runner-junit4 branch March 2, 2026 23:05
@olamy
olamy deleted the test-junit-platform-runner-junit4 branch March 2, 2026 23:05
// Determine the target class name based on stack trace or reportEntryName
String targetClassName = extractTestClassFromStack(reportEntry.getStack());
if (targetClassName == null) {
targetClassName = reportEntryName;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pshevche thanks for testing!
Would you mind creating an issue for this or this will be most

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, documented it here: #3315

@olamy olamy removed breaking Pull requests that break existing features removed Pull requests that remove features labels Mar 30, 2026
olamy pushed a commit that referenced this pull request Sep 10, 2026
…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>
mpkorstanje added a commit to jhalterman/typetools that referenced this pull request Oct 29, 2026
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.
mpkorstanje added a commit to jhalterman/typetools that referenced this pull request Oct 29, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet