Kotlin / kotlinx-kover

Apache License 2.0
1.37k stars 53 forks source link

Can I generate single report collecting the xml reports already generated? #645

Closed jpgpuyo closed 5 months ago

jpgpuyo commented 5 months ago

Hello, First of all, thanks for your effort, you are creating an amazing tool :)

Right now, I'm working in a big multimodule project and I am executing unit tests in multiple executions.

So, I would like to know if, once are executions are completed, is it possible to generate single report without executing unit tests again?

Thanks!

shanshin commented 5 months ago

Hi, could you clarify, are you running multiple executions on the same machine? if yes, then the Gradle build cache is suitable for you, so the tests will not be reruned, and the coverage value will be taken from the cache.

jpgpuyo commented 5 months ago

Thanks for your quick response @shanshin I have 2 use cases:

For solve the issue with github actions, I was thinking about upload all the xml to github artifacts, and then create another task to download all xmls and generate coverage, but not sure if in this case I will take advantage of gradle cache. I will investigate.

If no more solutions can be provided, then you can close this question :)

shanshin commented 5 months ago

This is a solvable issue, but the solution is not very convenient: there are special tasks called koverBinaryReport or koverBinaryReport<Variant>.

You can generate an HTML or XML report from several binary reports, but for this you need to pass the paths to all sources and all compiled classes. This can be done using the Kover CLI or a special Java dependency: org.jetbrains.kotlinx:kover-features-jvm:0.8.1 and function

jpgpuyo commented 5 months ago

Thanks! I will evaluate all the options :)

shanshin commented 5 months ago

Closed as answered. Feel free to create new issue if you have any additional questions.

shanshin commented 2 months ago

The ability to use coverage from already generated reports has been added in 0.9.0-RC

jpgpuyo commented 2 months ago

Thanks a lot for notifying me @shanshin Could you provide more information about how to use this new feature? Thanks!