square / spoon

Distributing instrumentation tests to all your Androids.
https://square.github.io/spoon/
Apache License 2.0
2.7k stars 477 forks source link

How to read merged-coverage.ec #556

Closed jihun-im closed 5 years ago

jihun-im commented 5 years ago

I generated merged-coverage.ec but I don't know how to read it. Could you tell me how to read it or is there a way to read it with jacoco?

dagerler001 commented 5 years ago

I generated merged-coverage.ec but I don't know how to read it. Could you tell me how to read it or is there a way to read it with jacoco?

I also encountered this problem and I found a solution

Add this gradle task in project https://gist.github.com/dagerler001/771418e0e12b109e23450fd45e767db1

If you using this plugin https://github.com/jaredsburrows/gradle-spoon-plugin

need add this, of course you did it ;)

spoon {
   codeCoverage = true
}

apply from: 'jacoco.gradle' insert it in your build.gradle (app)

after sync project will create task, you can find them

->Tasks:
   ->reporting:
           + jacoco${variantName}Report
           + create${variantName}FullCoverageReport

Also you can modified task dependsOn: add your tasks for example only spoonDebugAndroidTest I hope it's help you.

jihun-im commented 5 years ago

Thank you. I helped me solving the problem.