Using the RepetitionInfoParameterResolver Class

Understand the use of dependency injection in JUnit 5 using the RepetitionInfoParameterResolver class.

We'll cover the following

Dependency injection helps us access additional data about the test run using the RepetitionInfoParameterResolver interface.

This interface supplies an instance of RepetitionInfo. This provides different methods to retrieve information about the current repetition and the total number of repetitions for the @RepeatedTest.So, we only use this interface with the @RepeatedTest.

The RepetitionInfo parameter also facilitates the @BeforeEach and @AfterEach life cycle methods when used with the @RepeatedTest.

Example

Get hands-on with 1200+ tech skills courses.