gradle junit测试报告不是xml格式

时间:2017-02-03 17:07:32

标签: android xml junit android-gradle

我正在为Android gradle项目设置CI。要向CI报告,我需要标准的junit xml格式的报告文件。

在测试失败时,这是我得到的输出

* What went wrong:
Execution failed for task ':Mobile Application:testDevelopmentDebugUnitTest'.
> There were failing tests. See the report at:         file://path/build/reports/tests/developmentDebug/index.html

当我在构建路径下搜索任何xml文件时都不存在。

我正在使用3.3。 gradle的版本 以下是一些相关的build.gradle详细信息

android {
    dependencies {

        //test project dependencies
        androidTestCompile 'com.android.support:support-annotations:23.2.0'
        androidTestCompile 'com.android.support.test:runner:0.4.1'
        androidTestCompile 'com.android.support.test:rules:0.4.1'

        // Optional -- UI testing with Espresso
        androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
        // Required -- JUnit 4 framework
        testCompile 'junit:junit:4.12'
    }
}

为了获得junit格式的xml报告,我不知道我缺少什么。

1 个答案:

答案 0 :(得分:0)

我来这里是在寻找“如何从Gradle获取JUnit XML”

看起来(在Gradle 5.0中)可以使用;

plugins {
    id 'java'
    id 'application'
}

repositories { mavenCentral() }

test {
    reports {
        junitXml.enabled = true
    }
}

dependencies {
    testCompile 'junit:junit:4.12' // didn't work with jupiter/version5
}

...但是您的结果可能会有所不同。

相关问题