使用JaCoCo和Gradle进行浓缩咖啡测试的代码覆盖率为0% [英] 0% code coverage on espresso tests with JaCoCo and Gradle
问题描述
我的gradle配置:
<$
buildTypes {
debug {
testCoverageEnabled = true
}应用插件:'jacoco'
}
}
jacoco {
version'0.7.5.201505241946'
}
我跟着这篇博文:
首先我想问题可能在于源代码和测试代码的位置,但它们位于 / src / main / java /
和 / src /任何人有一个想法如何解决这个问题?
In my JaCoCo code coverage reports for my espresso tests, all lines and branches are missed. I am using JaCoCo in an Android application which is built with gradle 1.5.0.
My gradle configuration:
apply plugin: 'jacoco'
android {
buildTypes {
debug {
testCoverageEnabled = true
}
}
}
jacoco {
version '0.7.5.201505241946'
}
I followed this blog post: Test coverage report for Android application.
When I run createDebugCoverageReport
, the report is generated in the correct folder (build/reports/coverage/flavor/debug/index.html). However, when I open the coverage report, my code coverage is 0% on every instructions and branches. Everything is "missed".
First I thought that the problem could be the location of the source code and test code, but they are located in /src/main/java/
and /src/androidTest/java/
Anyone has an idea how to fix this?
As per my experience if any one test case fails then we get coverage report with 0% make sure all your tests passes
这篇关于使用JaCoCo和Gradle进行浓缩咖啡测试的代码覆盖率为0%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!