disabled = false
binaryReportFile.set(file("$buildDir/custom/debug-report.bin"))
// includes = ['com.example.*']
excludes = [
"com.makeappssimple.abhimanyu.financemanager.android.navigation.di.NavigationManagerModule"
我希望这段代码能排除
com.makeappssimple.abhimanyu.financemanager.android.navigation.di.NavigationManagerModule
文件,但它没有工作。
我也试过用通配符命名。
Kover setup,
plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-kapt"
id "dagger.hilt.android.plugin"
id "com.google.gms.google-services"
id "org.jetbrains.kotlinx.kover" version "0.5.0"
// Kover
kover {
disabled = false // true to disable instrumentation of all test tasks in all projects
coverageEngine.set(kotlinx.kover.api.CoverageEngine.INTELLIJ) // change instrumentation agent and reporter
intellijEngineVersion.set('1.0.656') // change version of IntelliJ agent and reporter
jacocoEngineVersion.set('0.8.7') // change version of JaCoCo agent and reporter
generateReportOnCheck = true // false to do not execute `koverMergedReport` task before `check` task
disabledProjects = [] // ["project-name"] or [":project-name"] to disable coverage for project with path `:project-name` (`:` for the root project)
instrumentAndroidPackage = false // true to instrument packages `android.*` and `com.android.*`
runAllTestsForProjectTask = false // true to run all tests in all projects if `koverHtmlReport`, `koverXmlReport`, `koverReport`, `koverVerify` or `check` tasks executed on some project
P.S: 我也提出了同样的问题here
2 个回答
0 人赞同
你也可以尝试在kover插件中添加一个过滤器,像这样version 0.6.0
kover {
instrumentation {
excludeTasks.add("testReleaseUnitTest")
filters {
classes {
excludes += listOf(
"dagger.hilt.internal.aggregatedroot.codegen.*",
"hilt_aggregated_deps.*",
"*ComposableSingletons*",
"*_HiltModules*",
"*Hilt_*",
"*BuildConfig",
".*_Factory.*",
0 人赞同
感谢山心's comment, I understood the issue.
使用此代码修正了单元测试覆盖率报告的排除列表
tasks.koverHtmlReport {
excludes = [
// Hilt
"*.di.*",
"dagger.hilt.**",
"hilt_aggregated_deps.*",
"<package_name>.*.*_Factory",
// Room
// MyRoomDatabase_AutoMigration_*_Impl, *Dao_Impl
"<package_name>.*.*_Impl*",
// BuildConfig
"<package_name>.BuildConfig",
// Moshi - Json Adapter