Reputation: 10699
Running ./gradlew createDebugCoverageReport
with Android gradle plugin v1.3.1 used to give me an html file that included code coverage percentage.
Now with gradle 1.5.0 and even with 2.0.0-alpha7 the report is much more limited, and doesn't show coverage percentage.
How can I reenable the coverage report?
Here's my gradle config:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha7'
}
}
allprojects {
repositories {
jcenter()
}
}
and
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "some.id"
minSdkVersion 10
targetSdkVersion 23
testApplicationId applicationId + ".test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
release {
// ...
}
debug {
debuggable true
testCoverageEnabled true
}
}
}
Upvotes: 2
Views: 1816
Reputation: 585
I noticed a similar behavior after running my tests with coverage. When I opened up index.html it just showed me which tests passed and which ones failed. It was not giving me the coverage percentages that I was used to seeing.
Here is an image of what I was seeing. As you can see, there are no percentage numbers to be found.
Then I realized that I was looking in the wrong folder! The above screenshot comes from: build/reports/androidTests/connected/index.html
The place you can go to see your coverage percentage is:
build/reports/coverage/debug/index.html
Based on the information you provided, I am not sure if you were making the same mistake I made by looking in the wrong place. I figured I would post my answer as it may help someone that was lost in the same way I was lost.
Upvotes: 3