Hi Ashish, +1 for migrating the Apache OFBiz testing framework from JUnit 4 to JUnit 6.
Best regards, Arun Patidar On Wed, May 27, 2026 at 3:51 PM Ashish Vijaywargiya < [email protected]> wrote: > Dear All, > > Yesterday, I was looking at the following Jira ticket: > https://issues.apache.org/jira/browse/OFBIZ-13138 > > Then I thought to start a discussion around migrating the Apache OFBiz > testing framework from JUnit 4 to JUnit 6 (JUnit Platform + Jupiter > ecosystem). > > Currently, the OFBiz trunk codebase is primarily based on JUnit 4. While > JUnit 4 has served the Java ecosystem well for many years, the JUnit team > has officially placed JUnit 4 into maintenance mode(see reference link > below). According to the official JUnit project, only critical bug fixes > and security updates are expected going forward, while active innovation > and ecosystem improvements are focused on the JUnit Platform and Jupiter > ecosystem. > > Because of this, migrating OFBiz to JUnit 6 could provide long-term > benefits in maintainability, modernization, ecosystem alignment, and > testing capabilities. > > Some key benefits of migrating to JUnit 6 include: > > 1. Modern Testing Architecture > JUnit 6 is built on the JUnit Platform architecture, which provides: > > * better modularity, > * improved extensibility, > * cleaner integrations, > * and modern testing infrastructure. > > 2. Gradual Migration Support > JUnit Vintage allows existing JUnit 4 tests to continue running while new > tests are written using Jupiter APIs. > This enables incremental migration without requiring a complete rewrite of > the entire OFBiz test suite. > > 3. Better Test Organization > JUnit Jupiter introduces modern testing features such as: > > * @Nested tests, > * @DisplayName, > * grouped assertions using assertAll(), > * dynamic tests, > * and cleaner lifecycle handling. > > These features improve the readability and maintainability of complex test > suites. > > 4. Improved Extension Model > - JUnit 6 replaces the older Runner and Rule model with a much cleaner > extension architecture. > - This makes custom testing utilities easier to develop and maintain. > > 5. Enhanced Parameterized Testing > - JUnit Jupiter significantly improves support for parameterized tests > using: > > * CSV sources, > * method sources, > * enum sources, > * and custom argument providers. > > This can help reduce repetitive test code across OFBiz modules. > > 6. Dependency Injection Support > - JUnit Jupiter provides built-in parameter injection support for lifecycle > methods and test methods. > - This helps simplify test setup logic and reduces boilerplate code. > > 7. Conditional Test Execution > - JUnit 6 supports conditional execution annotations such as: > > * @EnabledOnOs, > * @EnabledOnJre, > * @EnabledIfEnvironmentVariable, > * and @DisabledIfSystemProperty. > > These features are useful for CI/CD pipelines and environment-specific test > execution. > > 8. Parallel Test Execution > - Modern JUnit versions provide better support for parallel execution which > can help reduce overall CI execution time for large test suites. > > 9. Improved IDE and Tooling Support > - Modern IDEs and build tools provide much stronger support for JUnit > Jupiter: > > * improved debugging, > * richer test reporting, > * enhanced navigation, > * better parameterized test visualization, > * and improved test discovery. > > 10. Better Ecosystem Alignment > - Most modern Java frameworks, libraries, plugins, and testing utilities > are actively aligned with the JUnit Platform ecosystem. > - Migrating OFBiz helps keep the project aligned with modern Java > development practices. > > 11. Unified and Cleaner Dependency Management > - JUnit 6 provides unified versioning across Platform, Jupiter, and Vintage > modules, which simplifies dependency management and reduces compatibility > complexity. > > 12. Long-Term Sustainability > - Since JUnit 4 is now in maintenance mode, continued reliance on it > increases long-term technical debt. > - Migrating to JUnit 6 helps future-proof the OFBiz testing infrastructure. > > A few reference links: > https://docs.junit.org/6.1.0/migrating-from-junit4.html > https://github.com/junit-team/junit4/blob/main/README.md > https://junit.org/ > > I will work on this POC and will share updates soon with the OFBiz > community. > > If you have additional thoughts on this topic, please share. > Thank you. > > -- > Kind Regards, > Ashish Vijaywargiya > Vice President of Operations > *HotWax Systems* > *Enterprise open source experts* > http://www.hotwaxsystems.com >
