"约每测试覆盖任何信息"从声纳与Jacoco Ant构建 [英] "No information about coverage per test." from Sonar with Jacoco Ant build
问题描述
我使用Ant,Jacoco和声纳。当我运行我的生成声纳告诉我,大约每测试覆盖无资料。和超声波仪表盘有我的覆盖效果,但我不能深入到他们去看code。然而,Jacoco生成的HTML报告中包括深入到code。这是我的任务范围:
结果
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:
<jacoco:coverage destfile="${coverage.output.file}" >
<junit printsummary="on"
errorProperty="test.failed"
failureProperty="test.failed"
haltonfailure="yes"
fork="true">
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<classpath>
<path refid="test.build.class.path"/>
<pathelement location="${test.bin.dir}"/>
</classpath>
<batchtest todir="${results.dir}">
<fileset dir="${test.bin.dir}">
<include name = "**/**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<jacoco:report>
<executiondata>
<file file="${coverage.output.file}"/>
</executiondata>
<structure name="${ant.project.name}">
<classfiles>
<fileset dir="${bin.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}"/>
</sourcefiles>
</structure>
<html destdir="${coverage.results.dir}"/>
</jacoco:report>
</target>
和我的声纳目标是这样的:
And my Sonar target looks like this:
<target name="sonar" depends = "run">
<property name="sonar.jdbc.url" value="..." />
<property name="sonar.jdbc.username" value="...r" />
<property name="sonar.jdbc.password" value="..." />
<property name="sonar.projectKey" value="org.codehaus.sonar:example-java-ant" />
<property name="sonar.projectName" value="${ant.project.name} (ant)" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.language" value="java" />
<property name="sonar.sources" value="${src.dir}" />
<property name="sonar.binaries" value="${bin.dir},${test.bin.dir}" />
<property name="sonar.libraries" value="${lib.dir}/*.jar" />
<property name="sonar.dynamicAnalysis" value="reuseReports" />
<property name="sonar.surefire.reportsPath" value="${results.dir}" />
<property name="sonar.java.coveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPath" value="${coverage.output.file}" />
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath>
<fileset dir="${lib.dir}" includes="sonar-ant-task-2.0.jar"/>
</classpath>
</taskdef>
<sonar:sonar />
</target>
有谁知道我错过了什么?
Does anyone know what I am missing?
推荐答案
看起来你还没有设置'sonar.tests属性来告诉声纳在哪里可以找到你的单元测试的源$ C $ C。请参见 http://docs.sonarqube.org/display/SONAR/Analysis+Parameters。
It looks like you haven't set the 'sonar.tests' property to tell Sonar where to find the source code of your unit tests. See http://docs.sonarqube.org/display/SONAR/Analysis+Parameters.
大卫RACODON | SonarSource
David RACODON | SonarSource
这篇关于&QUOT;约每测试覆盖任何信息&QUOT;从声纳与Jacoco Ant构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!