Java Magazine, Nov/Dec 2016
ORACLE COM JAVAMAGAZINE NOVEMBER DECEMBER 2016 20 junit 5 In Part 1 of this article page 14 I wrote about the features coming in JUnit 5 In this article I provide more details on the framework and its integration with build tools such as Maven and Gradle All examples in this article are based on JUnit version 500 M2 which can be found on the project home page Architectural Overview Lets start with the packaging structure of JUnit 5 which was revised after its alpha release JUnit 5 now consists of three main packages Platform Jupiter and Vintage The packaging structure and modules are illustrated in Figure 1 which is current as of the M2 release JUnit Platform is the package that provides the foundation for the Vintage and Jupiter packages It contains the junit platform engine module which ofers a public API for integration of third party testing frameworks such as Specsy which is a behavior driven development or BDD style unitlevel testing framework for JVM languages The launching API that is provided for build tools and IDEs now resides under the junit platform launcher module Prior to version 5 both IDEs and test code used the same JUnit artifact The new more modular approach introduces a good separation of concerns by having build tool artifacts and the API segregated into different modules The junit platform runner module provides an API for running JUnit 5 tests on JUnit 4 The junit platform console module provides support for launching the JUnit platform from a console that will enable running JUnit 4 and JUnit 5 tests from the command line and printing execution results back to the console The junit platform surefire provider module contains the JUnitPlatformProvider class which integrates with the Surefire plugin to run JUnit 5 tests via Maven Surefire is the Maven plugin that runs JUnit tests during the test cycle In addition the junit platform Part 2 Using JUnit 5 Integrating with build tools and IDEs and running v5 tests with earlier versions Figure 1 The JUnit 5 architecture junit platform engine junit 412 junit vintage engine junit jupiter api junit jupiter engine JUnit 4 based test JUnit 5 based test junit platform launcher junit platform runner junit platform console IDEs Build Tools junit platform gradle plugin junit platform surefire provider PLATFORM VINTAGE JUPITER MERT ÇALIS KAN
You must have JavaScript enabled to view digital editions.