aburmeis / junit5-dataprovider-extension

JUnit5 extension to use data providers easily

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

junit5-dataprovider-extension

A TestNG like dataprovider extension for JUnit 5, see junit-dataprovider.

Usage Download

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.

Features

Supports @DataProvider and @UseDataProvider on methods with parameters annotated by @TestTemplate. Creates dynamic tests based on test templates.

Limitations

  • Widening calls (like data provider with int for a method with long parameter) will fail with a ParameterResolutionException.
  • Custom resolvers of @UseDataProvider are ignored.

Migration

  • Replace the old JUnit annotations by JUnit5 substitutes (typically an import change like org.junit.Test to org.junit.jupiter.api.TestTemplate.
  • Access to FrameworkMethod in @DataProvider has to be replaced by Executable.
  • Replace the @RunWith annotation of the test class by @ExtendWith(DataProviderExtension.class).

Providing a Custom DataConverter

  • Inherit from the DataProviderExtension and pass a custom DataConverter to the constructor.
  • Use the new extension in the @ExtendWith annotation.

Contribution CI status

The project is build with Gradle continuously by Travis CI.

About

JUnit5 extension to use data providers easily


Languages

Language:Java 100.0%