JUnit 5.6 release brings new features for Java unit testing

Java

The latest version of JUnit has arrived. The Java unit testing framework has performance improvements, new features and minor bug fixes on board in v5.6, but breaking changes have been added as well. Let’s take a closer look and see what has changed for JUnit’s three modules.

JUnit 5.6 has been released. The Java unit testing framework for developer-side testing on the JVM consists of the three modules JUnit Platform, JUnit Jupiter and JUnit Vintage. In v5.6, all modules have received upgrades.

JUnit Platform

The JUnit Platform comes with new features and breaking changes. The special expressions any() and none() have been added to let you run tests with or without any tags, whereas ReflectionSupport.findNestedClasses(…​) can now detect cycles within inner class hierarchies, and TestExecutionSummary.Failure is now serializable.

One of the breaking changes is a new behavior of the launcher, which previously logged and thereby potentially hid errors by default. In contrast, it now propagates errors during test discovery. By setting junit.platform.discovery.listener.default to logging, the previous default behavior can be restored.

Among other new features, the JUnit Platform has received bug fixes and deprecations.

JUnit Jupiter

Like the JUnit Platform, JUnit Jupiter has also received new features, deprecations and breaking changes. For example, JUnit Jupiter now supports multi-character delimiters in @CsvSource and @CsvFileSource, and custom null values are supported in @CsvSource and @CsvFileSource. A bug regarding @Nested was fixed as well.

JUnit Vintage

JUnit Vintage allows users to run JUnit 3 and JUnit 4 based tests, and some changes in JUnit 5.6 are designed to encourage JUnit Vintage users to upgrade to the recent version JUnit 4.13.

Furthermore, JUnit 3 suites with duplicate test names were previously not reported correctly. Version 5.6 not only fixes this bug, but also provides JUnit Vintage with performance improvements for larger projects.

Other changes

But that’s not all, as some overall changes were added regarding the Gradle Module Metadata, which is now published for all artifacts, and the OSGi metadata, which is now published in all binary JARs. There is also a new module API overview page for Javadoc.

[“source=jaxenter”]