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

RepetitionInfoParameterResolver

The second resolver provided out of the box in JUnit 5 is called RepetitionInfoParameterResolver. Given a test class, if a method parameter in a @RepeatedTest, @BeforeEach, or @AfterEach method is of type RepetitionInfo, the RepetitionInfoParameterResolver will supply an instance of RepetitionInfo.

RepetitionInfo can be used to retrieve information about the current repetition and the total number of repetitions for the corresponding @RepeatedTest. The API of RepetitionInfo offers two methods, as shown in the screenshot after the list:

  • int getCurrentRepetition(): Gets the current repetition of the corresponding @RepeatedTest method
  • int getTotalRepetitions(): Gets the total number of repetitions of the corresponding ...

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