JUnit 5 came out in September 2017, and is recommended as the preferred JUnit version to use when working with Java 8+, its also a highly requested feature of NetBeans users and so we need to start to outline how we provide support for JUnit 5 in Apache NetBeans (incubating).
Proposed Features
Provide JUnit 5.x library option
NetBeans allows users to add libraries to their projects via the Tools -> Libraries menu items. We should include JUnit 5.x libraries into this as standard. Note JUnit 5 is a departure from pervious versions, as such we will need to include the following artefacts:
- org.junit.platform:junit-platform-launcher:1.1.1:jar
- org.junit.jupiter:junit-jupiter-engine:5.1.1:jar
- org.junit.jupiter:junit-jupiter-api:5.1.1:jar
- org.junit.jupiter:junit-jupiter-params:5.1.1:jar
These artefacts will allow a user to write both normal JUnit 5.x tests and Parameterized JUnit 5 tests in their projects.
JUnit 5.x Test Class Template
Include a Test class template into the IDE that can be used by users to create a blank JUnit 5.x unit test.
Maven Projects - Create/Update Dialog
For Projects that are using Java 8, and have no existing version of JUnit, we should create JUnit 5 test by default.
Maven Projects - Test File and Debug Test File actions
These actions should still work as before.
Maven Projects - Run/Debug Focussed Test Methods
Users should still be able to right click a unit test method and be able to execute that specific test with surefire. Note in JUnit 5.x tests can be annotated with: @Test, @ParamerizedTest, @RepeatedTest, any annotation that extends @Testable
Maven Projects - Test Results Dialog
The test results dialog for JUnit 5.x tests should be able to handle, normal tests, tests with custom display names, parameterised tests, etc.
Project Inspection & Transformation
Provide support for users to Inspect their projects and provide a transformation route between JUnit 4.x tests to JUnit 5.x.