【问题标题】:How to generage .xml or .html with jacoco and spoon如何使用 jacoco 和勺子生成 .xml 或 .html
【发布时间】:2016-12-07 21:08:50
【问题描述】:

我可以设置spoon

spoon {
  //...
  codeCoverage = true
}

生成coverage.ec 文件。

如何在.xml.html 中生成报告?

【问题讨论】:

    标签: android android-testing spoon


    【解决方案1】:

    您可以使用内置的 Jacoco Gradle 插件创建自己的任务:

    apply plugin: 'jacoco'
    
    task jacocoTestReport(type: JacocoReport, dependsOn: ['<taskThatProducesEcFile>']) {
    
        reports {
            xml.enabled = true
            html.enabled = true
        }
    
        def fileFilter = ['**/R.class', <another filters...>]
        def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug",     excludes: fileFilter)
        def mainSrc = "${project.projectDir}/src/main/java"
    
        sourceDirectories = files([mainSrc])
        classDirectories = files([debugTree])
        executionData = files([<your_path_to_ec_file>])
    }
    

    【讨论】:

    • 你是对的,我在spoonDebugAndroidTest 之后使用了createDebugCoverageReport 任务,它会生成报告。
    猜你喜欢
    • 1970-01-01
    • 2020-09-20
    • 1970-01-01
    • 2014-04-03
    • 1970-01-01
    • 2021-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多