A TestNG like dataprovider extension for JUnit 5, see junit-dataprovider.
The extension can be found in the JCenter repository. It has transitive dependencies on junit-jupiter-api and junit-dataprovider. To run the tests you will at least need an JUnit 5 engine dependency.
Supports @DataProvider and @UseDataProvider on methods with parameters annotated by @TestTemplate. Creates dynamic tests based on test templates.
- Widening calls (like data provider with
intfor a method withlongparameter) will fail with aParameterResolutionException. - Custom resolvers of
@UseDataProviderare ignored.
- Replace the old JUnit annotations by JUnit5 substitutes (typically an import change like
org.junit.Testtoorg.junit.jupiter.api.TestTemplate. - Access to
FrameworkMethodin@DataProviderhas to be replaced byExecutable. - Replace the
@RunWithannotation of the test class by@ExtendWith(DataProviderExtension.class).
- Inherit from the DataProviderExtension and pass a custom
DataConverterto the constructor. - Use the new extension in the
@ExtendWithannotation.