days
-4
-3
hours
0
-1
minutes
-5
-6
seconds
-5
-4
search
The list is long, really

JUnit 5.3 arrives with lots of updates in tow

Eirini-Eleni Papadopoulou
Junit
© Shutterstock / Maksim M  

A few months after the 5.2 release, one of our most favorite testing frameworks is here with another update, packed with a long list of new features, bug fixes, and improvements. Let’s take a closer look!

The JUnit team released version 5.3 earlier this month and 5.3.1 just yesterday. It may look like a minor update but trust me, it brings a lot of good stuff with it!

Let’s jump into the long list of new features, bug fixes, and improvements!

All the shiny new things

We have a long list of new features and breaking changes for JUnit Platform, Jupiter and Vintage.

JUnit Platform

  • The junit-platform-gradle-plugin has been discontinued and is no longer released as part of JUnit 5.
  • The JUnit Platform Surefire Provider (junit-platform-surefire-provider) is now deprecated in favor of the native support for the JUnit Platform provided by Maven Surefire 2.22.0 and later versions.
  • The JUnit Platform Launcher now enforces that only TestEngine implementations published by the JUnit Team may use the junit- prefix for their TestEngine IDs.
  • The findAnnotation() methods in AnnotationSupport and AnnotationUtils no longer cache annotation lookups. Note, however, that the algorithm remains otherwise unmodified and is therefore semantically identical to the previous behavior.

The list of new features and improvements is truly extensive but just to give you a small taste:

  • Reusable support for parallel test execution for test engines that extend HierarchicalTestEngine.
  • Experimental support for capturing output printed to System.out and System.err during test execution.
  • The ConsoleLauncher now uses the picocli library under the hood to parse the command line and generate usage help.

You can check the official release notes for the full list.

JUnit Jupiter

  • In order to revert the aforementioned breaking change, variants of assertThrows() introduced in JUnit 5.3.0 that accept ThrowingSupplier arguments have been removed.
  • @Nested test classes can no longer override TestInstanceFactory extensions registered on an enclosing class. This aligns with the behavior for TestInstanceFactory extensions registered within a conventional test class hierarchy.

SEE ALSO: Big changes to JUnit 5.2

Once again, the list of new features and improvements is endless so I will refer you to the release notes. But just to give you an idea of what to expect:

  • New support for supplying a custom test source URI when creating a dynamic container or test.
  • New assertThrows methods in Assertions provide a more specific failure message if the supplied lambda expression or method reference returns a result instead of throwing an exception.
  • New {displayName} placeholder for the name attribute in @ParameterizedTest that allows developers to include the display name of the @ParameterizedTest method in a custom display name for invocations of that parameterized test.

JUnit Vintage

  • The VintageTestEngine now uses the simple name of a test class as the display name instead of the fully qualified class name. This aligns with the behavior of the JupiterTestEngine.

You can have a look at the changelog for the extensive list of bug fixes and visit the user guide for comprehensive reference documentation for programmers writing tests, extension authors, and engine authors as well as build tool and IDE vendors.

    DevOpsCon Whitepaper 2018

    Free: BRAND NEW DevOps Whitepaper 2018

    Learn about Containers,Continuous Delivery, DevOps Culture, Cloud Platforms & Security with articles by experts like Michiel Rook, Christoph Engelbert, Scott Sanders and many more.

gipugwe

Author
Eirini-Eleni Papadopoulou
Eirini-Eleni Papadopoulou is an assistant editor for JAXenter.com. Just finished her masters in Modern East Asian Studies and plans to continue with her old hobby that is computer science.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of