使用JaCoCo和Gradle进行浓缩咖啡测试的代码覆盖率为0% [英] 0% code coverage on espresso tests with JaCoCo and Gradle

查看:244
本文介绍了使用JaCoCo和Gradle进行浓缩咖啡测试的代码覆盖率为0%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的咖啡测试JaCoCo代码覆盖率报告中,所有行和分支都错过了。我在使用Gradle 1.5.0构建的Android应用程序中使用JaCoCo。



我的gradle配置:



<$
buildTypes {
debug {
testCoverageEnabled = true
}应用插件:'jacoco'


}
}

jacoco {
version'0.7.5.201505241946'
}

我跟着这篇博文:



首先我想问题可能在于源代码和测试代码的位置,但它们位于 / src / main / java / / src /任何人有一个想法如何解决这个问题?

>根据我的经验,如果任何一个测试用例失败,那么我们得到0%的覆盖率报告,确保所有的测试都通过了。


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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆