quot;No information about coverage per test.quot; from Sonar with Jacoco Ant build(“没有关于每次测试覆盖率的信息.来自 Sonar 和 Jacoco Ant 构建)
问题描述
我正在使用 Ant、Jacoco 和 Sonar.当我运行我的构建时,Sonar 告诉我没有关于每次测试覆盖率的信息".和声纳仪表板有我的覆盖结果,但我无法深入了解它们以查看代码.但是,Jacoco 生成的 HTML 报告确实包含深入代码.这是我的报道任务:
I'm using Ant, Jacoco and Sonar. When I run my build Sonar tells me that "No information about coverage per test." and the Sonar dashboard has my coverage results, but I cannot drill down into them to see the code. However, the HTML report generated by Jacoco does include drill down into the code. This is my coverage task:
我的声纳目标看起来像这样:
And my Sonar target looks like this:
有人知道我错过了什么吗?
Does anyone know what I am missing?
推荐答案
sonar.test
属性应该设置为测试类.我们的 maven pom 中有以下内容.对于 ANT,您可以执行类似的操作:
The sonar.test
property should be set to the test-classes. We have the following in our maven pom. For ANT you do something similar:
顺便说一句,这里还使用了一些其他属性:
Incidently there are some other properties being used in this:
- 我通过我的声纳用户生成了一个 SONAR 令牌,而不是使用登录名和密码
- JaCoCo 覆盖范围是使用
jacoco-maven-plugin
单独生成的,而sonar.jacoco.reportPath
是该插件中使用的属性.
- I've generated a SONAR token through my sonar user rather than use login and password
- JaCoCo coverage is being generated separately using the
jacoco-maven-plugin
and thesonar.jacoco.reportPath
is a property used in that plugin.
David Racodon 的回答 (https://stackoverflow.com/a/16645108/1019307) 曾经是正确的,但在2014 年年中,SonarQube 停止执行测试作为声纳执行的一部分 (http://www.sonarqube.org/unit-test-execution-in-sonarqube/).因此,为什么指向测试源不再有效.
David Racodon's answer (https://stackoverflow.com/a/16645108/1019307) was once correct but in mid-2014 SonarQube stopped executing the tests as part of the sonar execution (http://www.sonarqube.org/unit-test-execution-in-sonarqube/). Hence why pointing to the test source no longer works.
这篇关于“没有关于每次测试覆盖率的信息."来自 Sonar 和 Jacoco Ant 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!