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
int
for a method withlong
parameter) will fail with aParameterResolutionException
. - Custom resolvers of
@UseDataProvider
are ignored.
- Replace the old JUnit annotations by JUnit5 substitutes (typically an import change like
org.junit.Test
toorg.junit.jupiter.api.TestTemplate
. - Access to
FrameworkMethod
in@DataProvider
has to be replaced byExecutable
. - Replace the
@RunWith
annotation of the test class by@ExtendWith(DataProviderExtension.class)
.
- Inherit from the DataProviderExtension and pass a custom
DataConverter
to the constructor. - Use the new extension in the
@ExtendWith
annotation.