days
-1
-4
hours
-2
0
minutes
-3
-6
seconds
-1
-3
search
All the highlights of the newest release

JUnit 5.5 arrives with several tweaks and enhancements

JUnit
© Shutterstock / garagestock  

The latest version of JUnit 5 may seem like a small release but, in fact, it brings several new enhancements that make JUnit 5.5 an important release. Let’s have a quick look at what’s new.

The JUnit team is keeping up with their fast release cycle and the bring us the next version of JUnit 5.

The 5.5 release, even though it doesn’t bring any big new features, it does bring several tweaks and enhancements that make it an important release.

Let’s have a look at some of the highlights in JUnit 5.5.

What’s new in JUnit 5.5?

@RegisterExtension updates – There are several constraints around how @RegisterExtension can be used. Now, violating these constraints will cause an exception to be thrown, whereas previously fields that violated these constraints would be silently ignored. What’s more, until now, the declared field of @RegisterExtension must also implement an Extension interface. The JUnit team relaxed this constraint that only the assigned value of the field must implement Extension.

TestExecutionListener updates – When a TestExecutionListener throws an exception, the stacktrace is instead printed to the console at the WARN level. This allows the test suite execution to continue, but for the information about an error occurring not being lost, and also being clearly indicated.

MethodOrder updates – If a seed isn’t supplied via the junit.jupiter.execution.order.random.seedproperty, JUnit will generate a seed for you. Now, when this happens JUnit will also print log statement displaying the seed value used. This allows a test run to be recreated if a problem was discovered.

Execute classes in parallel – There are further improvements to the support of parallel test execution. More specifically:

  • junit.jupiter.execution.parallel.mode.classes.default has been added, that allows support for defining how parallel test execution should interact at the class level
  • There are two default values accepted SAME_THREAD and CONCURRENT, like with ​​junit.jupiter.execution.parallel.mode.default
  • junit.jupiter.execution.parallel.mode.classes.default will default to the value that junit.jupiter.execution.parallel.mode.default is set to, which is SAME_THREAD by default

Deprecation of enableIf/disabledIf (currently slated to be removed in 5.6) – Ultimately, this method provided little benefit overwriting an implementation of DisabledCondition, while having the drawbacks of creating a maintenance headache as the script would have to be copy-and-pasted if it was to be reused and also being slower to execute.

As mentioned earlier, this release brings a big list of changes, so please head over to the official release notes to see all the new enhancements.

Author
Eirini-Eleni Papadopoulou
Eirini-Eleni Papadopoulou is the editor for JAXenter.com. Coming from an academic background in East Asian Studies, she decided that it was time to go back to her high-school hobby that was computer science and she dived into the development world. Other hobbies include esports and League of Legends, although she never managed to escape elo hell (yet), and she is a guest writer/analyst for competitive LoL at TGH.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of