Reputation: 73
I have an Android library (jar file) containing some APIs and I want to do code coverage test for these APIs using Jacoco.
For example, I have a calculator library (may name it calc.jar), having some APIs to do add, subtract, multiple and divide (via some static method such as Calc.doAdd(a,b), Calc.doSubtract(a,b) etc...). Now I have another Android test application (created by Android Studio) using this calculator library. I would like to do code coverage for this calculator library (surely I have calculator library source code).
I am also successfully do code coverage test with EMMA and ant. As Android Studio now uses Gradle for building, so I would like to know if we can do code coverage (I searched and see that Gradle can work with Jacoco).
I do searched and see that there are some topic relating to Jacoco code coverage for Android Application. But I am looking a way for doing code coverage for JAR library using Jacoco and Gradle. Please give me a help. If there are topics relating to this, please help to show me.
Many thanks in advance,
Upvotes: 7
Views: 1927
Reputation: 126
According to Issue 76373 you can't get code coverage for libraries. Some people seems to have been successful with some hacks but I've not found anything that works for me.
Upvotes: 2