kotlinx-kover
kotlinx-kover copied to clipboard
Coverage verification is flaky
Describe the bug I have Android multimodule project with 19 modules. Each module apply kover plugin with similar configuration
kover {
reports {
filters {
excludes {
androidGeneratedClasses()
annotatedBy(
"androidx.compose.ui.tooling.preview.Preview",
"androidx.compose.runtime.Composable"
)
classes(
"ru.*.*.ComposableSingletons*"
)
classes(
// excludes here
)
}
}
verify {
rule {
minBound(80)
}
}
}
}
After run multiple times koverXmlReportDebug and koverVerifyDebug different result are outcome. Sometimes build is finished successful, sometimes it fails randomly.
But reports in failed modules showed that all lines were covered and no missed code.
Errors
Running command gradle koverXmlReportDebug koverVerifyDebug generate
Execution failed for task ':core-di:koverVerifyDebug'.
> Rule violated: lines covered percentage is 0.000000, but expected minimum is 80
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
437 actionable tasks: 19 executed, 418 up-to-date
or
* What went wrong:
Execution failed for task ':init-api:koverVerifyDebug'.
> Rule violated: lines covered percentage is 0.000000, but expected minimum is 80
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':mvi:koverVerifyDebug'.
> Rule violated: lines covered percentage is 0.000000, but expected minimum is 80
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
BUILD FAILED in 13s
Expected behavior Tasks are executed without errors.
Reproducer
You can try run multiple times tasks koverXmlReportDebug and koverVerifyDebug or gradle koverXmlReportDebug koverVerifyDebug in https://github.com/glebkacode/kinofest projects. As well you can try run gradle clean koverXmlReportDebug koverVerifyDebug result will be the similar.
Reports
Environment
- Kover Gradle Plugin version: 0.9.1
- Gradle version: 8.9
- Kotlin project type: Kotlin/Android
- Coverage Toolset (if customized in build script): Kover
- Other context important for this bug: Android