https://kotlinlang.org logo
#code-coverage
Title
# code-coverage
u

Ulrich Winter

07/11/2023, 10:55 AM
Hello! I’m upgrading kover from 0.6.x to 0.7.2 but I struggle to create a merged xml report. I’m applying the kover plugin at the toplevel project and all the sub projects and this gets me multiple xml report files, but no merged one. I understood, that I need to add a
kover
element as dependency of the parent project like described in the Readme:
Copy code
dependencies {
  kover(project(":another:project"))
}
But this produces only a very rudimentary report file at my toplevel location: after
gw check koverXmlReport
:
Copy code
cat  ./build/reports/kover/report.xml
<?xml version="1.0" ?>
<report name="Intellij Coverage Report">
<counter type="INSTRUCTION" missed="0" covered="0"/>
<counter type="BRANCH" missed="0" covered="0"/>
<counter type="LINE" missed="0" covered="0"/>
<counter type="METHOD" missed="0" covered="0"/>
<counter type="CLASS" missed="0" covered="0"/>
</report>
The sub projects do contain non-empty files like
./subproject/build/reports/kover/report.xml
with relevant coverage data. My parent build.gradle file looks like this:
Copy code
// ...
subprojects { subproject ->
    apply {
        plugin "org.jetbrains.kotlin.jvm"
        plugin 'org.jetbrains.kotlin.plugin.serialization'
    }
    if(subproject.name != "e2e") {
        apply {
            plugin 'org.jetbrains.kotlinx.kover'
        }
        dependencies {
            kover(project(subproject.path))
        }
    }
// ...
}
koverReport {
    defaults {
    }
    filters {
        projects {
        }
    }
}
What am I missing?
The only difference with regard to the example I can spot is: There are additional levels between the parent project and the subprojects like:
Copy code
./libs/libproject1
./apps/app1
./build.gradle
the reason was: the root project needs to define the
kover
dependencies to its subprojects, which was not the case instead this dependency was part of the subproject’s dependencies.
e

Erick Sanchez

07/14/2023, 5:12 PM
Did you resolved?
u

Ulrich Winter

07/14/2023, 5:14 PM
Yes
65 Views