How to create an HTML report for JUnit 5 tests?

前端 未结 3 1260
闹比i
闹比i 2020-12-16 18:18

Is there already a possibility to generate an HTML report when JUnit tests were started via Gradle? Any hint or comment is appreciated.

3条回答
  •  独厮守ぢ
    2020-12-16 18:39

    Yes, you can using Jacoco plugin.

    Here is an example:

    apply plugin: 'war' or apply plugin: 'java'
    apply plugin: "jacoco"
    
    test {
        reports.junitXml.destination="build/test-results"
        jacoco {
            destinationFile = file("build/jacoco/jacoco.exec")
            append=true
        }
    }
    
    jacocoTestReport {
        reports {
            xml.enabled false
            csv.enabled false
            html.destination "${buildDir}/jacocoHtml"
        }
    }
    

    Regards.

提交回复
热议问题