Gradle 6.1 + JUnit 5: интеграционные тесты не генерируют отчеты xml или html - PullRequest
2 голосов
/ 30 января 2020

У меня есть следующий build.gradle в мультипроекте:

plugins {
    id 'idea'
    id 'eclipse'
    id 'java'
}

sourceSets {
    integrationTest {
        java {
            compileClasspath += main.output + test.output
            runtimeClasspath += main.output + test.output
            srcDir file('src/integration-test/java')
        }
        resources.srcDir file('src/integration-test/resources')
    }
}

configurations {
    integrationTestImplementation.extendsFrom testImplementation
    integrationTestCompile.extendsFrom testCompile
    integrationTestRuntime.extendsFrom testRuntime
}

test {
    useJUnitPlatform()
    minHeapSize = "2048m"
    maxHeapSize = "6144m"
    reports {
        junitXml.enabled = true
        html.enabled = true
    }
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
    testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.6.0'

    integrationTestRuntime 'org.junit.jupiter:junit-jupiter-engine:5.6.0'

    compile "org.seleniumhq.selenium:selenium-java:3.141.59"
}

task integrationTest(type: Test) {
    useJUnitPlatform()

    minHeapSize = "10g"
    maxHeapSize = "10g"

    outputs.upToDateWhen { false }

    group = LifecycleBasePlugin.VERIFICATION_GROUP
    description = 'Runs the integration tests.'

    testClassesDirs = sourceSets.integrationTest.output.classesDirs
    classpath = sourceSets.integrationTest.runtimeClasspath

    binResultsDir = file("$buildDir/integration-test-results/binary/integrationTest")

    reports {
        html.enabled = true
        junitXml.enabled = true
        html.destination = file("$buildDir/integration-test-results")
        junitXml.destination = file("$buildDir/integration-test-results")
    }

    mustRunAfter tasks.test
}

Когда я запускаю gradle интеграцииTest, запускаются интеграционные тесты, но в двоичном отчете генерируется только:

build / интеграция-тест-результаты / двоичный файл / интеграцияTest

Нет XML или HTML результатов! Кажется, что JUnit 5 радикально изменил что-то по сравнению с JUnit 4. Как я могу получить отчеты XML или HTML?

...