如何解决使用 Firebase testLab 生成代码覆盖率报告获取一份报告而不是多个 .ec 文件
我正在尝试使用 firebase testLab 生成代码覆盖率报告。下面是我在 gCloud 中运行的命令。所有测试都通过了,我生成了几个 .ec 文件。每个测试一个,但我没有看到报告。谁能告诉我我可能做错了什么?我该怎么做才能得到报告?
-
我想用代码覆盖率合并报告。
-
无法打开 .ec 文件
gcloud firebase test android run --type instrumentation --app --test --device model=blueline,version=28,locale=en,orientation=portrait --environment-variables USERNAME=,PASSWORD=,coverage=true,coverageFilePath="/sdcard/coverage.ec" --directories-to-pull /sdcard --use-orchestrator --test-targets=
Jacoco 任务:
task jacocoTestReport(type: JacocoReport,dependsOn: ['testDebugUnitTest','createDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class','**/R$*.class','**/BuildConfig.*','**/Manifest*.*','**/*Test*.*','android/**/*.*']
def debugTree = filetree(dir: "$project.buildDir/intermediates/classes/debug",excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.from = files([mainSrc])
classDirectories.from = files([debugTree])
executionData.from = filetree(dir: project.buildDir,includes: [
'jacoco/testDebugUnitTest.exec','outputs/code-coverage/connected/*coverage.ec'
])
解决方法
Firebase 测试实验室不直接生成覆盖率报告。为此,您需要使用 jacoco
之类的工具来解析您的 .ec
文件。此 blog 给出了这样做的示例。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。