问题
I have an app based as follows:
Spring Framework
5.0.4.RELEASEGradle
4.7 - multimodule project configured throughJUnit
5.1.1
The configuration about Gradle with JUnit is in the build.gradle
file located in the root module:
...
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.junit.platform.gradle.plugin'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
repositories {
jcenter()
}
ext {
...
junitVersion = '5.1.1'
...
}
dependencies {
...
//Testing
...
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testCompile "org.junit.jupiter:junit-jupiter-params:$junitVersion";
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
....
}
test {
useJUnitPlatform()
}
}
//This location is mandatory
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.junit.platform:junit-platform-gradle-plugin:1.1.0"
}
}
Through Jenkins
I execute:
gradle :thymeleaf-02-infrastructure:test --parallel
- and with
Publish JUnit test result report
is configured tothymeleaf-02-infrastructure/build/test-results/junit-platform/*.xml
From above all work fine, I can see in Jenkins
the @Test
passed but Gradle
does not generate the report
directory with the expected html
file.
Even if directly the gradle :thymeleaf-02-infrastructure:test --parallel
command is executed in the terminal, all work (tests passe), but Gradle
does not generate the report
directory with the expected html
file.
I already have read these links:
- How to use JUnit 5 with Gradle?
- How to create an HTML report for JUnit 5 tests?
And well I am using
test {
useJUnitPlatform()
}
and Gradle
is >4.6, 4.7, so what is missing?
回答1:
You need to remove the org.junit.platform.gradle.plugin
because it disables the standard test
task by default.
来源:https://stackoverflow.com/questions/49922797/configuration-for-gradle-4-7-to-generate-the-html-report-for-junit-5-tests