androidTestCompile 'com.android.support.test:runner:0.4.1'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4.1'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Espresso-contrib for DatePicker, RecyclerView, Drawer actions, Accessibility checks, CountingIdlingResource
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1'
时至今日,安卓官方已经支持了生成jacoco测试覆盖
使用Android Test Support Library
在debug闭包中添加
运行
./gradlew createDebugAndroidTestCoverageReport
更多可以参考我的文章: http://segmentfault.com/a/1190000003901086