O'Reilly logo

Mastering Software Testing with JUnit 5 by Boni García

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parameterized tests

Parameterized tests are a special kinds of tests in which the data input is injected in the test in order to reuse the same test logic. This concept was already addressed in JUnit 4, as explained in Chapter 1, Retrospective On Software Quality And Java Testing. As we would expect, parameterized tests are also implemented in JUnit 5.

First of all, in order to implement a parameterized test in Jupiter, we need to add the junit-jupiter-params to our project. When using Maven, that means adding the following dependency:

<dependency>    <groupId>org.junit.jupiter</groupId>    <artifactId>junit-jupiter-params</artifactId>    <version>${junit.jupiter.version}</version>    <scope>test</scope></dependency>
As usual, as a general rule, it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required