gpt4 book ai didi

android - 执行 connectedCheck 后,Realm 生成的类包含在覆盖率报告中

转载 作者:行者123 更新时间:2023-11-28 21:21:46 24 4
gpt4 key购买 nike

问题是 Jacoco 在启用测试覆盖率的情况下执行 ./gradlew connectedCheck 后报告 Realm 生成的类。

Realm 生成大量代码,这使得覆盖率报告不可靠。

这就是测试覆盖率的样子: Actual coverage report

connectedCheck 报告中删除 io.realm 包的最简单方法是什么?

最佳答案

如果我选择 Google GithubBrowserSample into account which has the following task in its build.gradle :

task fullCoverageReport(type: JacocoReport) {
dependsOn 'createDebugCoverageReport'
dependsOn 'testDebugUnitTest'
reports {
xml.enabled = true
html.enabled = true
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*',
'**/*Test*.*', 'android/**/*.*',
'**/*_MembersInjector.class',
'**/Dagger*Component.class',
'**/Dagger*Component$Builder.class',
'**/*_*Factory.class',
'**/*ComponentImpl.class',
'**/*SubComponentBuilder.class']
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"

sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: "$buildDir", includes: [
"jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
])
}

您很可能会添加一个文件过滤器,例如 io.realm.*RealmProxy.class

关于android - 执行 connectedCheck 后,Realm 生成的类包含在覆盖率报告中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49756166/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com