JUnit Platform
The foundation of modern JUnit that discovers and runs tests, on which build tools and editors launch test engines such as JUnit Jupiter.
In more detail
Gradle must be told useJUnitPlatform() in its test task, otherwise it looks for tests written for the old JUnit 4 API and runs none. Maven's Surefire plugin detects the platform automatically.
Example
tasks.test { useJUnitPlatform() }Related terms
- JUnit — The standard testing framework for Java, which discovers methods marked @Test, runs them and reports each failure with the test's name.
- Maven Surefire Plugin — The Maven plugin that runs unit tests during the test phase and writes their reports to target/surefire-reports.
- Gradle task — A unit of work in a Gradle build, such as compileJava or test, which declares its inputs and outputs and its dependencies on other tasks.
Taught in
- The Toolchain: Gradle — Modern Java: Virtual Threads & High-Throughput Services
- Testing Basics With JUnit 5 — Modern Java: Virtual Threads & High-Throughput Services