@RepeatedTest with Display Name

This lesson demonstrates how to use @RepeatedTest annotation with a custom display name.

@Repeated Tests with @DisplayName

In our previous lesson, we saw how to use @RepeatedTest annotation to run tests multiple times. @RepeatedTest takes in a value of type integer. This integer value is the count of the number of times the test case will be executed. The output of Junit Test case in the previous lesson had the default display name for the test case. In this lesson, we can also provide custom display name using @DisplayName annotation over @RepeatedTest. The name attribute of @RepeatedTest can be used to provide a custom display name.

Let’s look into a demo.

Get hands-on with 1200+ tech skills courses.