I am developing apps using Android Studio.
I was able to run the test code.
But, I do not know how to get code coverage in android studio.
I have a
We use maven to build our app and cobertura for code coverage reporting
both are really easy to integrate
android maven integration:
http://www.vogella.com/tutorials/AndroidBuildMaven/article.html
Maven + Cobertura Code Coverage Example:
http://www.mkyong.com/qa/maven-cobertura-code-coverage-example/
You can just right click on the package you are curious about and select Run 'Tests in "package" with coverage'
Enable testCoverage in your module build.gradle
file
buildTypes {
debug {
testCoverageEnabled true
}
}
and then
Right click on the test -> java package and select Run Tests in Java with Coverage
to run all tests with code coverage or right click on the particular test class and click Run SampleTest with Coverage