Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing log output from Jacoco when showing coverage results #544

Open
realdadfish opened this issue Feb 16, 2024 · 1 comment
Open

Confusing log output from Jacoco when showing coverage results #544

realdadfish opened this issue Feb 16, 2024 · 1 comment
Assignees
Labels
Bug Bug issue type S: postponed Status: work on the issue is not in the short term plans

Comments

@realdadfish
Copy link

It seems to me as if the Jacoco Ant task to check for coverage get's the percent value of the coverage reported, while it needs to work with the floating point value. Anyways, this is what I see:

> Task :my-component:app:koverLog
[ant:jacocoReport] Rule violated for bundle :app: lines covered ratio is 0.2664, but expected minimum is 1.0000

> Task :my-component:app:koverPrintCoverage
:app line coverage: 26.64%

The expected coverage for this module is 28%, with a threshold of 5%, i.e.

val minBound = (expected - threshold).coerceAtLeast(0)
val maxBound = (expected + threshold).coerceAtMost(100)

so the minBound should be 23 and the maxBound should be 33. The extension is then configured like this:

koverReport {
    verify {
        rule {
            minBound(minBound)
            maxBound(maxBound)
       }
    }
}

The koverVerify task also runs through as expected, just the log output is confusing.

Environment

  • Kover Gradle Plugin version: 0.7.6-SNAPSHOT
  • Gradle version: 8.5
  • Kotlin project type: Kotlin/Android
  • Coverage Toolset: JaCoCo("0.8.11")
@realdadfish realdadfish added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Feb 16, 2024
@shanshin
Copy link
Collaborator

shanshin commented Feb 16, 2024

For now, you can ignore the output of the task koverLog and analyze only logs from koverPrintCoverage.

In JaCoCo, the coverage value is now obtained through verification, and so far it is not very clear how to disable logging into stderr :(.

Later, we will try to explore how we can disable JaCoCo err logging or find another easy way to get values.

@shanshin shanshin added S: postponed Status: work on the issue is not in the short term plans and removed S: untriaged Status: issue reported but unprocessed labels Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: postponed Status: work on the issue is not in the short term plans
Projects
None yet
Development

No branches or pull requests

2 participants