use Junit5 instead of TestNG

We want to be able to use @SpringBootTest tests that fully initialize
the Spring application. This is much easier done with Junit than TestNG.
Gradle does not support (at least not easily) to run Junit and TestNG
tests. Therefore we switch to Junit with all tests.
The original reason for using TestNG was that Junit didn't support
data providers. But that finally changed in Junit5 with
ParameterizedTest.
This commit is contained in:
2019-12-13 14:33:20 +01:00
parent 394e16ad27
commit 07ad62ddd9
26 changed files with 660 additions and 837 deletions

View File

@@ -81,16 +81,19 @@ subprojects {
}
}
// In this example we use TestNG as our testing tool. JUnit is the default.
test{
useTestNG()
//testLogging.showStandardStreams = true
useJUnitPlatform {
includeEngines 'junit-jupiter'
excludeEngines 'junit-vintage'
}
}
// dependencies that all sub-projects have
dependencies {
testImplementation group: 'org.testng', name: 'testng', version: '6.14.3'
}
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.2' // for @ParameterizedTest
testImplementation 'org.junit.platform:junit-platform-launcher:1.5.2' // needed by eclipse
}
task eclipseSettings(type: Copy) {
from ("${rootProject.projectDir}/eclipse/") {