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

Missing coverage for public extension method #561

Closed
Faltenreich opened this issue Mar 8, 2024 · 2 comments
Closed

Missing coverage for public extension method #561

Faltenreich opened this issue Mar 8, 2024 · 2 comments
Assignees
Labels
Bug Bug issue type S: waiting for clarification Status: additional information required to proceed

Comments

@Faltenreich
Copy link

Faltenreich commented Mar 8, 2024

Describe the bug
Kover shows zero coverage for a public extension method.

Errors
Kover shows a different coverage than Android Studio's "Run with Coverage".

Expected behavior
Kover should show the same coverage as Android Studio's "Run with Coverage".

Reproducer

// src/main/kotlin/<package>/SampleExtensions.kt
// interesting: displayed as "SampleExtensionsKt" in Kover's HTML report
fun Sample.doSomethingInExtension() { ... } // Kover: 0% coverage
// src/main/kotlin/<package>/SampleViewModel.kt
// displayed as "SampleViewModel" in Kover's HTML report
class SampleViewModel {
    fun doSomethingInViewModel() {
        Sample().doSomethingInExtension() // Kover: 100% coverage
    }
}
// src/test/kotlin/<package>/SampleViewModelSpec
class SampleViewModelSpec : io.kotest.core.spec.style.WordSpec() {
    init {
        "SampleViewModel" should {
            "call extension" {
                SampleViewModel().doSomethingInViewModel()
            }
        }
    }
}

Environment

  • Kover Gradle Plugin version: 0.7.4
  • Gradle version: 8.4
  • Kotlin project type: Kotlin/Android (using Gradle Android Plugin 8.2.0)
  • Coverage Toolset (if customized in build script): Kover
  • Other context important for this bug: Kotest 5.8.0, Android Studio Iguana | 2023.2.1
@Faltenreich Faltenreich added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Mar 8, 2024
@shanshin
Copy link
Collaborator

Hi,
could you check in the 0.7.6 version?

If the error is going to be reproduced, could you provide a small reproducer project? I was unable to reproduce the error locally.

@shanshin shanshin added S: waiting for clarification Status: additional information required to proceed and removed S: untriaged Status: issue reported but unprocessed labels Mar 13, 2024
@Faltenreich
Copy link
Author

Please excuse my late response, as we have not been able to examine this issue furthermore until now.

Now that we have, we realized that this issue is directly linked to #599. The missing code coverage has nothing to do with the extension itself but with the fact that its test is located in another module. Generating a total report with Kover 0.8.0 produces the expected code coverage.

Therefore I will close this issue and thank you again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: waiting for clarification Status: additional information required to proceed
Projects
None yet
Development

No branches or pull requests

2 participants