Kotlin / kotlinx-kover

Apache License 2.0
1.37k stars 53 forks source link

Getting No coverage information was found with Kover 0.7.6 #652

Closed jigarpandyadev closed 4 months ago

jigarpandyadev commented 4 months ago

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

shanshin commented 4 months ago

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?

jigarpandyadev commented 4 months ago

@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.

shanshin commented 4 months ago

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).

jigarpandyadev commented 4 months ago

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

shanshin commented 4 months ago

In this case, a reproducer project is needed

jigarpandyadev commented 4 months ago

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

shanshin commented 4 months ago

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

jigarpandyadev commented 4 months ago

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.

shanshin commented 4 months ago

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
jigarpandyadev commented 4 months ago

thanks for the help @shanshin.