Hi :wave:, I'm currently trying to integrate Kover...
# code-coverage
m
Hi 👋, I'm currently trying to integrate Kover in our multi module repository. Thanks to the documentation I was able to get it running quickly following the chapter ", but I had to change our build pipeline in an unwanted way. Before we had the test tasks for each module separately in the pipeline so it's easy to see which module fails because of a unit test. According to the documentation I had to pick one merging module (i picked root) and when i run e.g. `:koverHtmlReport`all tests for all modules are executed and the merged report is generated. Therefore I disabled the seperate test tasks as there is no need to run each test twice in the pipeline. Preferably, we would like it the other way around: Execute the tests sperately and only merge the coverages into one report at the end. TL;DR: Is it possible to separate execution of tests (and measurement of code coverage) and generation of the merged coverage report?
c
That's why it's two different tasks.
Copy code
./gradlew koverVerify :koverHtmlReport
koverVerify
: verify each module independently (no prefix means "all modules")
:koverHtmlReport
: create a report only for the root module (
:
means "only the root module")
m
I haven't configured any verification rules yet, so I'm not sure thats what I need... e.g.: In my pipeline I run the following tasks somwhere during the build • ./gradlew libAtest • ./gradlew libBtest • ./gradlew: clienttest • ./gradlew servertest And at the end of the pipeline we'd like to collect the coverage of all the previously ran unit-tests and merge them into one report without running the tests again. Because at the moment, running ./gradlew :koverHtmlReport always exectutes all tests of all modules.
c
Ah, yes. This is not possible to get in a single report, to my knowledge. However, you could generate a report each: •
./gradlew :libA:test :libA:koverHtmlReport
./gradlew :libB:test :libB:koverHtmlReport
• …
m
ohh .. I think I just found something. When I generate binary reports for each module then it should be possible to merge them into one binary report at the end and from that I can generate the html/xml/... report. https://kotlin.github.io/kotlinx-kover/cli/#merging-binary-reports
Merging binary reports
Allows you to merge multiple files into single binary report.
Generating reports
Allows you to generate HTML and XML reports from the existing binary report.
So it might not be possible via gradle, but via the Kover CLI.
c
Then maybe create an issue on the GitHub tracker to add that feature to the Gradle plugin
👍 1