Skip to content

Instantly share code, notes, and snippets.

@vinogradoff
Created June 18, 2018 20:49
Show Gist options
  • Save vinogradoff/564aba4812e1351b50b7bd9be4baf275 to your computer and use it in GitHub Desktop.
Save vinogradoff/564aba4812e1351b50b7bd9be4baf275 to your computer and use it in GitHub Desktop.
parametrized junit5 surefire
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.vinogradoff</groupId>
<artifactId>neoj4test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-neo4j</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.assertj.core.api.Assertions.assertThat;
public class SimpleTest {
@ParameterizedTest
@ValueSource(strings = {"a", "b", "c"})
void doSmth(String param) {
assertThat(param).isNotBlank();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="SimpleTest" time="0.097" tests="3" errors="0" skipped="0" failures="0">
<testcase name="doSmth{String}[1]" classname="SimpleTest" time="0.065"/>
<testcase name="doSmth{String}[2]" classname="SimpleTest" time="0.001"/>
<testcase name="doSmth{String}[3]" classname="SimpleTest" time="0.001"/>
</testsuite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment