Jacoco和Sonar代码覆盖范围? [英] Jacoco and Sonar code coverage?

查看:215
本文介绍了Jacoco和Sonar代码覆盖范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用: JaCoCo 0.5.3,Maven2,Sonar 2.14,sonar-maven-plugin 1.8,SùartGWT3.0
当前正在尝试::了解我的Selenium单元测试的Sonar代码.
问题:尽管传感器已正确启动,但代码覆盖率并未从0%上升,请分析正确生成的jacoco.exec.
资源: https://gist.github.com/2888912 pom. xml

Using : JaCoCo 0.5.3, Maven2, Sonar 2.14, sonar-maven-plugin 1.8, SùartGWT 3.0
Currently trying to : Get code coverage on Sonar of my Selenium unit tests.
Problem : Code coverage doesn't move from 0% although the sensor is launched properly, analyse the jacoco.exec which is correctly generated.
Ressources : https://gist.github.com/2888912 The pom.xml

大约2个星期以来,我一直在尝试覆盖代码.我将Sonar从2.10升级到2.14,更改了每个声纳属性,尝试使用插件jacoco(适用于Maven),但仍然无法获得任何结果.因此,如果有人遇到相同的问题并找到了解决方案,能否请您告诉我您如何工作?

It's been about 2 weeks I'm trying to get code coverage. I upgraded the Sonar from 2.10 to 2.14, changed every single sonar property, tried the plugin jacoco (for maven) and I still DON'T get any results. So if someone had the same problems and found the solution, could you please tell me how you amde it work ?

我非常确定我的测试必须至少产生0.5%的代码覆盖率.我的Selenium测试实际上是在SeleniumTestLoginEntry.java中执行的,是否有任何影响?我必须将其称为TestLoginEntry.java吗? (测试的类是LoginEntry.java) 我正在使用surefire启动JaCoCo的javaagent(请参见标签),它实际上生成了jacoco.exec.

I'm quite sure my tests must generate at least 0.5% of code coverage. My Selenium tests are actually executed in SeleniumTestLoginEntry.java, does it have any incidence ? Must I call it TestLoginEntry.java ? (The tested class is LoginEntry.java) I'm using surefire to start the javaagent of JaCoCo (see the tag) and it actually GENERATES the jacoco.exec.

请给我一些帮助,我完全迷路了,我只有一个星期的时间才能使它工作... :(
提前致谢.

Please give me some help, I'm totally lost I have only one week left to make it work... :(
Thanks in advance.

推荐答案

我使用的是Ant和Sonar 3.01,设置与您的设置略有不同,但是...有一个属性对我有用,当我看时,似乎几乎完全没有证件.我注意到Wiki页面在最近几天进行了更新,这可能改变了文档状态.

I'm in a slightly different setup than you are, using Ant and Sonar 3.01, but... there was one property that did the trick for me, that seemed to be almost entirely undocumented when I looked. I notice the wiki pages have had updates in the last couple of days, which may have changed the doc situation.

<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPath" value="${test.log.dir}/jacoco.exec"/>

最终为我工作的是显式地将sonar.jacoco.reportPath设置为文件而不是目录.

Setting sonar.jacoco.reportPath explicitly to the file, not a directory, was what finally worked for me.

这篇关于Jacoco和Sonar代码覆盖范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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