JUnit 5 Tutorial

This JUnit 5 tutorial teaches us how to write tests for our Java code. Eventually, we cover writing of both unit and integration tests.

Currently, the tutorial consists of the following blog posts:

  • Maven Example – Configure Maven dependencies for writing JUnit 5 tests and Maven Surefire plugin for running them.
  • Gradle Example – Configure Gradle dependencies for writing JUnit 5 tests and JUnit Gradle plugin for running them.
  • Parameterized tests – Learn to remove duplication from test code by writing JUnit 5 parameterized tests. Use different sources of parameters to run the same test several times using different input.

Also, if you are already familiar with JUnit 4, you might be interested in:

  • Migrating from JUnit 4 to JUnit 5 – Learn the steps required for migrating from JUnit 4 to JUnit 5. Run your existing JUnit 4 tests along with JUnit 5, or migrate the code to the new version.