Closed anudeepikamunnangi closed 2 weeks ago
while, I was running testcase in debug mode in my local with Java11. This testcase recursiveDepthArrayFor1000Levels is passing.
@anudeepikamunnangi Thanks for opening the issue. Is there some compelling reason to upgrade to Junit 5 at this time?
@stleary, Thanks for reviewing the PR and the issue.
Before i go with advantages, i would like to confirm that, i did not change any test case logic. All i did is to make it work in JUNIT 5 way of writing the same test cases.
Recently, in our automation team, we migrated our legacy applications from JUNIT 4 to JUNIT 5. We observed that there are below advantages.
Let’s start with the previous version, JUnit 4 , which has some clear limitations:
The idea behind JUnit 5 was to completely rewrite JUnit 4 in order to negate most of these drawbacks.
Thanks for the response. No objection to using Junit 5, but small steps are preferred over mass changes. Recommend just upgrading the version for now, but keeping the existing tests. I think Junit 5 has a library to support that.
I'm happy if JUnit 5 is adopted I really like the new version.
Keep in mind that JUnit 5 has a few differences from JUnit 4, which means lots of syntax changes on the test package.
org.junit.Assert.assertTrue
org.junit.jupiter.api.Assertions.assertTrue
@rikkarth "Thanks for highlighting the differences. I've ensured code adheres to JUnit5 standards, including the changes you mentioned."
In relation to the closed PR https://github.com/stleary/JSON-java/pull/848 I want to clarify that it is not possible to upgrade to JUnit 5 without lots of syntax changes, therefor this will inevitably be a big effort.
Parameterized dependency and test are not mandatory if you want to keep the upgrade and PR smaller and easier to review in a first stage.
Alternatively we can use JUnit vintage (provided by JUnit team) which is an engine which provides backwards compatibility with Junit 3 and 4, JUnit vintage is used specially for cases like this, migrations.
This would mean, that if we perform the upgrade like I'm suggesting we are able to produce small, focused PRs that are easier to digest, review and test without breaking anything and maintaining existing functionality.
I've used it professionally in the past to upgrade JUnit from 4 to 5.
I recommend a new branch from master and a new PR.
https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4 (official) https://www.baeldung.com/java-junit-vintage-engine-vs-junit-jupiter-engine
cc @stleary
Closing due to the amount of effort to upgrade vs actual benefit of migrating to JUnit5.
I tried to upgraded the code base to Junit 5 to get new features for unit testing. Below are the steps, I followed :
Steps: