JUnit 5 M1

I am resurrecting this blog for a very special occasion: we, the JUnit 5 team, have released the first milestone of JUnit 5 this Thursday. A tremendous amount of work has been completed since we shipped the alpha version in February: 138 issues have been resolved, 766 commits have been pushed to master. We had fruitful discussions with many contributors and early adopters. Thanks to everyone who participated and helped to make it happen!

JUnit 5This release focussed on providing stable APIs for IDEs and build tools. For that, we had to get the naming right. We’ve split the modules into three groups: Platform, Jupiter, and Vintage. Combined they comprise JUnit 5. In fact, I talked to Anna from JetBrains after the talk of Matthias Merdes and me at Java Forum Stuttgart this week. She really appreciated the way we’ve structured and documented things. Therefore, I am really confident that at least IntelliJ IDEA will provide native support for JUnit 5 very soon.

In addition, this release introduces a new concept I am really excited about: dynamic tests. They make it possible to use arbitrary logic to create tests at runtime. You simply write a method that returns a Collection or Stream of DynamicTests. Here’s an example of how to use them with the current Jupiter API:

@DisplayName("all Fibonacci numbers are odd")
Stream<DynamicTest> testFactory() {
    return IntStream.range(1, 20)
            .mapToObj(aFibonacci -> dynamicTest("Fibonacci = " + aFibonacci, () -> isOdd(aFibonacci)));

We are really curious to learn if dynamic tests are useful to test writers out there. So, please provide us with feedback! We introduced dynamic tests in M1 so IDEs can take care of displaying them correctly from the start. It is very likely that we will use them under the hood for other features as well, e.g. for parameterized tests.

We still have a lot on our agenda for 5.0.0 GA with parameterized tests and scenario tests being the biggest features yet to come. So, stay tuned! And don’t forget to give 5.0.0-M1 a test drive and let us know what you think!

blog comments powered by Disqus