Maven Surefire Plugin
The Maven plugin that runs unit tests during the test phase and writes their reports to target/surefire-reports.
In more detail
Surefire discovers test classes, runs them through the JUnit Platform and prints a summary line such as Tests run: 11, Failures: 0. A failing test fails the build. -DskipTests tells it to skip running tests.
Example
[INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0Related terms
- plugin — An add-on that extends a tool with extra features, such as the Maven and Gradle plugins that compile, test and package Java code.
- Maven build lifecycle — Maven's fixed, ordered list of phases, validate, compile, test, package, verify, install and deploy, where asking for one runs all before it.
- JUnit — The standard testing framework for Java, which discovers methods marked @Test, runs them and reports each failure with the test's name.
- -DskipTests — A Maven command-line property that builds and packages the project without running the tests.
Taught in
- The Toolchain: Maven — Modern Java: Virtual Threads & High-Throughput Services