Kotlin/kotlinx-kover

Getting No coverage information was found with Kover 0.7.6

jigarpandyadev opened this issue · 10 comments

I am using Kover 0.7.6 for a multi-module android app.
in project's build.gradle, have added plugin
id("org.jetbrains.kotlinx.kover") version "0.7.6" apply false

Also based on an open issue, have added

subprojects {
    project.tasks.whenTaskAdded { task ->
        if (task.name.toLowerCase().contains("koverhtmlreport")) {
            task.doNotTrackState("Don't support state tracking")
        }
    }
}

in app module's build.gradle,
id("org.jetbrains.kotlinx.kover")

 koverReport {
    androidReports("debug"){
        filters {
            excludes {
                classes(
                        "*Fragment",
                        "*Fragment\$*",
                        "*Activity",
                        "*Activity\$*",
                        "*.databinding.*",
                        "*.BuildConfig"
                )
            }
        }
    }

}

and also added depenedencies of other modules in app module
kover project(":module")

also added kover plugin to other modules. but I keep getting the error like in the attached screenshot. Any help is appreciated.

Screenshot 2024-07-08 at 8 21 28 PM

Hi,
could you please clarify, which task do you use to generate the report?
And is the set of Android build variants the same in all modules?

@shanshin I have only debug and release variants for all modules. I tried with ./gradlew koverHtmlReport and ./gradlew koverHtmlReportDebug commands. I also tried version 0.8.2. Also when I run ./gradlew koverLog command, I get No sources for some of the modules.

Using 0.8.2, try to call ./gradlew :app:koverHtmlReportDebug and open the report in the build directory of the app module (if you specify dependencies { kover(project("...")) } in app).

I tried as you suggested but still no help.
Screenshot 2024-07-09 at 3 46 10 PM

In this case, a reproducer project is needed

Can you check in this demo project, why modules common2 and library2 have No coverage information was found problem
Sketchboard.zip

I tried your example, call ./gradlew clean :app:koverHtmlReportDebug, open file specified in logs file:///.../app/build/reports/kover/htmlDebug/index.html and there are classes in it.

Screenshot 2024-07-09 at 12 59 02

Please double check that you are opening a new generated report

Hey @shanshin thanks for checking. pls see in the attached screenshot that you shared, it doesn't list packages from common2 and library2 modules. My concern is, I'm unable to generate coverage for all the modules.

As far as I can see, there is not a single class in the library2 or common2 package in your project.
Screenshot 2024-07-09 at 13 14 43

If you add any class there, for example CommonClass, you will see it in the report
Screenshot 2024-07-09 at 13 16 41

thanks for the help @shanshin.