-
Notifications
You must be signed in to change notification settings - Fork 204
Deprecate JUnit 4 provider with warning message #5554
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
|
Do I understand correct that every project in the entire ecosystem MUST migrate their unit tests? Something that the Platform has spent years trying complete? That seems like an absolute non-starter for most project that have far less resource than the platform? |
|
No that means these projects need to use JUnit5 vintage instead of "native" Junit4 to launch their test... but this is more currently to explore the impact (on platform and tycho itself) |
I am curious who spent "years" on trying to migrate. My experience is there is no real interest in getting a cleanup to do the job. https://github.com/carstenartur/sandbox?tab=readme-ov-file#8-sandbox_junit |
|
The real problematic are the cases of JUnit 2(or smth else that predated JUnit 3) concepts (heavy inheritance, manual discovery and mangling of tests to be run, etc. ) wrapped in weird way of JUnit 3 API to be run on JUnit 4. One left such example is https://github.com/eclipse-jdt/eclipse.jdt.core/blob/8486242e76588947678a6487e33586b6b91f4ddf/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava13Tests.java#L59 . Untangling cases like that is what has been taking time (and is done to a huge extend in Platform) and IMO these are not suitable for automatic conversion. A regular test conversion is mostly find-and-replace exersice so not a problem (EDIT: Oversimplified statement!). |
I tend to disagree here. You can easily loose tests migrating from junit 3 to 4 with a find and replace approach. Not talking about the change in the order of the parameters in a number of cases. Pre Junit 3 might be worse but the usage of inheritance in jdt.core or jdt.ui is difficult to migrate for a cleanup. |
|
@carstenartur please don't hesitate to discussion the topic further here. As Tycho can even execute cleanup-actions, one approach would be to even discover ways offering your cleanup in an automated way. Maybe we even found users don't need to migrate at all because we can simply map junit4 > junit5+vintage... I think everything is open at the moment. |
|
Imho a deprecation is the right thing at one point. You still can stay with old Eclipse versions if you have to. Ideally you offer help at the same time for migration. To make it technically possible to stay on the old code might be a short time mitigation to some issues but that leads to a shrinking community because young developers hate to learn code from their father or grandfather if that is not buying them a lot of productivity which is not the case here. There is a reason why junit evolved further. In some corner cases you might see differences in test execution time making use of newer libraries. I once offered a contribution for jdt.ui additionally to display user and system cpu time for the tests. It has been rejected but my tests showed a visible improvement of the accuracy of the test execution time with newer versions of junit. I do not know what is with dependencies in other non java code parts. I did not check lately: is this resolved? |
JUnit 4 has been outdated for years with clear migration paths available (JUnit 5, JUnit Vintage). This adds a deprecation warning when the JUnit 4 provider is selected.
Changes
AbstractEclipseTestMojo.java: Log warning whenjunit4provider is selected (bothcreateProvisionedInstallation()andcreateEclipseInstallation()paths)JUnit4Test.java: Add test verifying deprecation warning appears in build logsWarning Message
The warning triggers whenever Tycho auto-detects or explicitly uses the JUnit 4 provider, appearing in Maven build logs to guide users toward migration.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
testng.org/opt/hostedtoolcache/CodeQL/2.23.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/working/files-to-index15662911680924776615.list --sourceArchiveDir=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/tycho/.codeql-scratch/dbs/java/trap/java(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.