Espresso Test Coverage Support
Can we get a flag that allows us to include espresso test coverage in our test coverage report?
At the moment that's not possible. I'll investigate if that is feasible, and perhaps add it into 2.0.0 release, along with other larger features.
It should be possible when not using the test orchestrator's clear package data flag.
cs showing the boolean you care about: https://cs.android.com/android/platform/superproject/+/master:tools/base/build-system/gradle-core/src/main/groovy/com/android/build/gradle/internal/model/BuildTypeImpl.java?q=testCoverageEnabled
so its on the BuildType so that makes me think at least this is an option:
android {
buildTypes {
debug {
testCoverageEnabled = true
}
}
}
since android has no jvm agents it tracks coverage via compile time bytecode instrumentation. brace yourself for longer build times when that is turned on.
it might be useful to see if it can be set via flavor rather than just type and have a dedicated flavor for instrumentation runs and/or add a project property lookup to decide if it should be true or false.
bug about test orchestrator clear data issue: https://issuetracker.google.com/issues/123987001
Great, thank you for the insight.
I am planning to separate test and analysis tasks (currently analysis task will always run tests first).
This would allow adding instrumentation test coverage flag along with unit test coverage flag.
I'm creating a list of features for the 2.0.0 release, and this will be one of them.