Junit Dataprovider

A JUnit5 Parameterized implementation (Similar to TestNG DataProvider)

License

License

Categories

Categories

IDE Development Tools JUnit Unit Testing Data
GroupId

GroupId

com.kncept.junit5.dataprovider
ArtifactId

ArtifactId

junit-dataprovider
Last Version

Last Version

0.9.3-M6
Release Date

Release Date

Type

Type

jar
Description

Description

Junit Dataprovider
A JUnit5 Parameterized implementation (Similar to TestNG DataProvider)
Project URL

Project URL

https://github.com/kncept/junit-dataprovider
Source Code Management

Source Code Management

https://github.com/kncept/junit-dataprovider

Download junit-dataprovider

How to add to project

<!-- https://jarcasting.com/artifacts/com.kncept.junit5.dataprovider/junit-dataprovider/ -->
<dependency>
    <groupId>com.kncept.junit5.dataprovider</groupId>
    <artifactId>junit-dataprovider</artifactId>
    <version>0.9.3-M6</version>
</dependency>
// https://jarcasting.com/artifacts/com.kncept.junit5.dataprovider/junit-dataprovider/
implementation 'com.kncept.junit5.dataprovider:junit-dataprovider:0.9.3-M6'
// https://jarcasting.com/artifacts/com.kncept.junit5.dataprovider/junit-dataprovider/
implementation ("com.kncept.junit5.dataprovider:junit-dataprovider:0.9.3-M6")
'com.kncept.junit5.dataprovider:junit-dataprovider:jar:0.9.3-M6'
<dependency org="com.kncept.junit5.dataprovider" name="junit-dataprovider" rev="0.9.3-M6">
  <artifact name="junit-dataprovider" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.kncept.junit5.dataprovider', module='junit-dataprovider', version='0.9.3-M6')
)
libraryDependencies += "com.kncept.junit5.dataprovider" % "junit-dataprovider" % "0.9.3-M6"
[com.kncept.junit5.dataprovider/junit-dataprovider "0.9.3-M6"]

Dependencies

compile (1)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.0.0-M6

test (1)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.0.0-M6

Project Modules

There are no modules declared in this project.

junit-dataprovider Build Status

This plugin is outdated. JUnit5 contains this functionality in its core

Dataprovider like functionality for JUnit5.

See ExampleUseCasesTest for a more detailed example.

Usage should generally follow the follow pattern of snippets:

import static com.kncept.junit.dataprovider.testfactory.TestFactoryCallback.instanceProvider;

@TestFactory
public Collection<DynamicTest> testFactory() {
	return instanceProvider(this);
}

@ParameterSource(name = "src1")
public static List<Object[]> src1() {
	return asList(
			new Object[]{"val1"},
			new Object[]{"val2"}
	);
}

@ParameterisedTest(source = "src1")
public void checkValue(String value) {
	assertNotNull(value);
}

The @Disabled and @DisplayName anotations from Junit5 are supported.

This plugin uses the DynamicTest functionlaity of Junit5 to replicate the old JUnit4 @Parameterized or TestNG DataProvider style of tests.

Simply ensure that the distribution jar is on the test classpath, then use it as in the example. N.B. This release is compiled against the JUnit 5.0.0-M6 Milestone release.

The jar is available on Maven Central

testCompile 'com.kncept.junit5.dataprovider:junit-dataprovider:0.9.3-M6'

<dependency>
    <groupId>com.kncept.junit5.dataprovider</groupId>
    <artifactId>junit-dataprovider</artifactId>
    <version>0.9.3-M6</version>
</dependency>

This plugin uses the same license as (most of) JUnit5 - EPL 1.0.

Enjoy.

Versions

Version
0.9.3-M6
0.9.2-M3
0.9-M3