Manuel Jordan
Manuel Jordan

Reputation: 16301

Configuration for Gradle 4.7 to generate the HTML report for JUnit 5 tests

I have an app based as follows:

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:

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:

And well I am using

test {
    useJUnitPlatform()      
}

and Gradle is >4.6, 4.7, so what is missing?

Upvotes: 2

Views: 2121

Answers (1)

Marc Philipp
Marc Philipp

Reputation: 1908

You need to remove the org.junit.platform.gradle.plugin because it disables the standard test task by default.

Upvotes: 4

Related Questions