How can Kotlin operator functions be covered in test reports?
Since
kotlinx-kover
does not support instrumentation tests executed on Android device, I am still using a Jacoco gradle task for generating code coverages.
In this case,
operator fun
's signature is marked uncovered by Jacoco, although the method body is being covered (see screenshot)!
How can I cover the method signature? Would there be any workaround to cover it?
m
marlonlom
03/28/2023, 3:49 PM
Did you add unit tests for the suspend function?
afaik, when running the jacoco report, it takes the coverage for unit tests and not for the instrumented ones
@chanjungskim Good point, but that doesn't seem to be the case, since the existing coverage is also coming from instrumented tests.
If it helps, feel free to view/clone the project here:
https://github.com/trustedshops-public/etrusted-android-trustbadge-library
You can run all the tests with coverage from commandline using:
Copy code
bundle exec fastlane test
The HTML coverage file will be under following path: