-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple issues when migrating from custom plugin to kotlinx-kover #398
Comments
Hi, However, the filtering code should not work very long. |
This is the expected behavior, Kover default tasks are always created. For Android, they are empty so that the user himself can add a report of interesting build variants to them with In general, it can take a long time to build a report for all build variants and often causes errors, because some classes with the same name may be duplicated in different variants. |
I'm checking the execution with |
At the moment, tests executed on Android devices or in the emulator are not supported. |
I have only a single build variant, |
No, these are pure JVM tests, Robolectric does not need a device or emulator. Still, it is noticable that even though the JVM UI tests run, I get no coverage reported for any UI-related classes. |
For your case, you may specify |
I'm a bit reluctant to switch to kover instrumentation / coverage, because a) I have a partially mixed source with legacy code being written in Java (and IIRC this is only supported with Jacoco, right?) and b) the coverage results will probably vary quite a bit when the tool is changed (at least I got completely different coverage values when I switched between IntelliJ coverage and Jacoco in the IDE in the past), but I guess I'll try anyway. The reason why I also stick to Jacoco 0.8.8 is because I also saw coverage deviations between different Jacoco versions and for now I kind of want a "reproducible" coverage result. But I'll also try 0.8.10 which is the newest IIRC. |
Is your project open source ? |
Ok, this has very low resolution, it just tells me that the |
Unfortunately not, all closed source. Have you experience with https://github.com/gradle/gradle-profiler-plugin, would this be helpful to create profile data with this? |
A large number of classes in the project? Could you remove the |
Yes, running now. |
Not yet, but it will be useful to understand whether the slowdown occurs during filtering or during validation by JaCoCo itself. For comparison, you may try to remove all report filters and compare whether the build time will speed up (in this case, the code from here will not be executed). |
|
The same task with Jacoco, but without class filters, took 1,9s, so the filters are definitely the culprit. |
How many class-files do you have in the project? |
FYI - Also, with the configured
so this does not seem to work either. So I skip this for now and only call / work with the Android variants of the specific tasks for now. |
See above, about 2700 prod class files in the |
The creation of the Kover (non Jacoco) HTML report took almost 40s, not exactly fast either. What's good is that this reports a somewhat correct line coverage of 81% for the module. Will check the verification task now. |
To generate the report, Kover analyzes all class-files and all sources, so it can work slowly on large projects. |
Also, I configured a minValue of 47 and a maxValue of 52, but when I execute |
Yes, verification should fail. For more info, please add rule minValue=100 and maxValue=0 to see verification error |
Will do that. Btw... thanks for your / JetBrains work on this, even if it is not yet perfect. A proper coverage solution for JVM/Android/multiplatform projects was long overdue. So thanks again, also for your instant support! |
Hah, nice that my custom
|
Last post from me here today (will be back on Monday), but I can't get verification to work. I execute it like this
and use the output of Problem is that the task succeeds, even with this configuration:
|
Hi, To configure validation for the
|
Ah I see, I thought this was common configuration that was shared. |
I simply don't get it - it will just not execute the verification rule:
I try to make a small example project now. Can't seem to get this working like this. |
Please, for checking, write exactly as in the example above (for example, for a variant
and execute Configuring inside |
It might be better to postpone the migration until issue #362 is fixed. Current configuration issues complicate the stable reproduction of complex configuration cases. |
The problem I'm facing right now is that I can't lazy-populate the plugin with settings from my build convention extension, without relying on It's also not entirely clear to me how the Thanks so far for your time and effort! |
In most cases, it is enough to use
Only if individual filters are needed for any particular build variant, then these filters can be overridden:
However, this is a very rare case. All filters are inherited from the level above and can overload each other, see |
Describe the bug
I have had a custom build convention plugin with which I set up code coverage for my Gradle apps. Upon getting the news that kotlinx-kover exists I decided to replace my custom implementation with one that internally configures / uses kotlinx-kover.
Upon this I encountered several issues:
In Android projects, the non-variant-aware tasks
koverVerify
,koverHtmlReport
, ... are created, though they're useless and result in being skipped when executed, because there are no tests executed (naturally):I think it would be better if the creation of these tasks would either be skipped or if they would act as aggegration tasks, i.e.
koverHtmlReport
would execute allkoverHtmlReport
tasks of all active / configured build variantsWhen I look at the HTML report after all tests have been executed and coverage has been calculated, the Jacoco report tells me only 22% of my example module are covered, whereas previously I had more than 80% coverage. When I drill down into the details I see that especially Robolectric-based UI tests get no coverage reported at all. Are there any special settings needed to get the coverage for those tests as well?
koverXmlReport
/koverVerify
seems to stall indefinitely. When I connect with the Gradle debugger I see that there are dozens of "Unconstrained build operation" threads that are all in parked state. In smaller modules it eventually seems to finish the tasks after some time, but then the configured thresholds (upper and lower) don't seem to let the build fail; instead the verification task always runs green and is even cached afterwards when I try to execute it again.This is my configuration (stripped to the basic minimum):
This is
CoverageExtension.kt
:This is the configuration of an example module that reported around 90% coverage:
Environment
The text was updated successfully, but these errors were encountered: