我正在为 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 报告。
最佳答案
我来这里是为了寻找“如何从 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
}
...但您的结果可能会有所不同。
关于android - gradle junit测试报告不是xml格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42029431/