https://kotlinlang.org logo
#android
Title
# android
a

Alejandro Rios

07/24/2020, 12:24 PM
Hello, anyone knows some tool to use for
Code Coverage
besides Jacoco or Sonar?, i'm looking if there's an alternative to do that on an Android project that's written in Kotlin
e

Eugene

07/24/2020, 12:30 PM
No ideas what it may be, but wondering why do you need it? For what?
a

Alejandro Rios

07/24/2020, 12:32 PM
I'm just looking for alternatives to Jacoco or Sonar to check the Code coverage of my project
e

Eugene

07/24/2020, 12:42 PM
It's hard to recommend something when you don't specify the reason why you do it. Anyway, I never heard about alternatives.
👍 1
a

Alejandro Rios

07/24/2020, 12:55 PM
🤔 , ok, maybe I'm not explaining well, so here it goes, i have and Android project that's fully Kotlin, we use Jacoco and Sonar to check the Code Coverage of the project, by that, i mean if our tests covers the most lines/blocks/arcs of the project, the reason why i'm asking about this is that right now sonar it's being noisy to configure(modularized project here) so we have disable it
We need to enable it again, but i was wondering if there are alternatives or another tool that we can use
c

Christopher Elías

07/24/2020, 2:23 PM
Hello, this I use SonarCube for some code lint checks, I don't know if I am getting your question right but, I think I would prefer to use Detek on a full kotlin project rather than SonarCube. https://proandroiddev.com/detecting-kotlin-code-smells-with-detekt-e79c52a35faf
a

Alejandro Rios

07/24/2020, 2:25 PM
Thanks @Christopher Elías, I'm going to check that
j

Justin Tullgren

07/24/2020, 4:06 PM
Jacoco/sonar is the only unit test code coverage tool I know of. Detekt is a static code analyzer just like sonar but strictly for kotlin and reports on code smells/bugs.
is there a particular problem with jacoco?
👍 1
i believe jacoco correctly determines coverage now with the generated kotlin byte code
👍 1
a

Alejandro Rios

07/24/2020, 4:23 PM
I'm not saying that there's a problem with those two, well, maybe Sonar, but NVM, I was wondering if there were alternatives for that, as research
m

Matt Fenlon

07/24/2020, 4:26 PM
My team uses Codecov, which supports Java and Kotlin. It does the job for me. Was straightforward to set up on CircleCI.
d

Dave Leeds

07/24/2020, 6:16 PM
I’d love to see a CI-compatible code coverage tool for Kotlin that could report information consistently for all platforms in a Kotlin Multiplatform project.
r

rolgalan

07/25/2020, 6:56 PM
Codecov is just the interface (with the configuration checks for CI purposes). You still need to run the tests with a code coverage tool to generate the reports that are consumed by Codecov. Usually JaCoCo is that tool
1
If you use Jacoco, make sure to run the latest version (0.8.5) as it properly excludes some extra branches generated by kotlin code that does not make sense to test