junit5

Can we use @RepeatedTest along with @ParameterizedTest in Junit 5


Currently, I'm (attempting to) migrate existing Junit4 Project to Junit5.

I'm stuck in a place where I have to use both @RepeatedTest and @ParameterizedTest. Attempting this throws the default exception - No Runnable Methods found

As an alternative, I should be able to pass Parameters to each of my test from two different sources - which ends up in Null values for the second source.


Solution

  • No, it is not possible to use @RepeatedTest and @ParameterizedTest on the same method since both are implementations of a @TestTemplate, and a method can have only one test template. See JUnit 5 issue #1224 for details.

    Note, however, that JUnit Jupiter will eventually support container templates. See JUnit 5 issue #871 for details.