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

czuckie

11/23/2023, 9:09 AM
will kover ever actually support android instrumented tests?
p

pajatopmr

12/13/2023, 9:29 PM
I'm surprised to see this query. My recollection is that Kover does work with instrumented tests in general (tests that I wrote and measured to 100%) but fails miserably with @Composable code. Do you have a simple example that makes your case? If not, don't worry because I am about to embark on a testing marathon for some Android code I am converting to KMP that currently has no automated tests.
c

czuckie

12/14/2023, 9:52 AM
Support for Kotlin Android projects with build variants (instrumentation tests executing on the Android device are not supported yet).
That's on the readme for kover. I think testing Android code on the JVM works ok, i.e. tests in
src/test
rather than
src/androidTest
. It's one of the biggest pains of android dev (cliche I know) that I can't simply run all my tests and see the code coverage without hours of painstaking configuration of jacoco and even then I can't see the coverage inside the IDE (I think due to the .exec and .ec formats, though I've not tried for a while). Good luck Paul! I'd be very interested to hear what your strategy is and how well you do.
Also, just to dogpile on the @Composable stuff, yeah it's a nightmare, in a codebase where I'm certain we have 95%+ coverage, we currently have 73% and I'm fairly certain it's due to compose compiler shenanigans. I say 73% coverage, I think what I mean is 73% average on instructions, lines, methods, classes and complexity. It's not a super duper useful metric, but we're just tracking the delta rather than the value since we're delivering the project using TDD.
p

pajatopmr

12/15/2023, 6:02 AM
👍
5 Views