Note that there are some explanatory texts on larger screens.

plurals
  1. POSonar IT using JaCoCo givess 0% code coverage
    primarykey
    data
    text
    <p>I am running Sonar Java code analysis on RHEL6 machine using Ant. For Integration test analysis I am using JaCoCo plugin for sonar. I have the plugin in my library class path. When I run my Selenium tests, a "jacoco.exec" file is generated (around 1MB for 10 tests). I then activate the Jacoco plugin in my Sonar Ant target and import it to Sonar. Sonar analysis logs say that Jacoco file has been analysed (took around 5000ms). However, My Sonar IT widget displays 0% code coverage. I have successfully got the unit test code coverage by using Cobertura.</p> <p>My test target:</p> <pre><code>&lt;taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"&gt; &lt;classpath path="${buildHome}/libs/jacocoant.jar"/&gt; &lt;/taskdef&gt; &lt;jacoco:coverage xmlns:jacoco="antlib:org.jacoco.ant"&gt; &lt;junit fork="yes" failureproperty="true" forkmode="once" maxmemory="1024m"&gt; &lt;formatter type="xml" /&gt; &lt;classpath refid="buildClasspath" /&gt; &lt;test name="${testName}" todir="${testLogs}" if="testcase" /&gt; &lt;batchtest haltonerror="false" todir="${testLogs}"&gt; &lt;fileset dir="${SeleniumScripts"&gt; &lt;include name="**/*.java" /&gt; &lt;/fileset&gt; &lt;/batchtest&gt; &lt;/junit&gt; &lt;/jacoco:coverage&gt; </code></pre> <p>My Sonar Ant target:</p> <pre><code>... &lt;property name="sonar.sources" value="${srcCode" /&gt; &lt;property name="sonar.tests" value="${testCode}" /&gt; &lt;property name="sonar.binaries" value="${srcAndTestBinaries}" /&gt; &lt;property name="sonar.dynamicAnalysis" value="reuseReports"/&gt; &lt;property name="sonar.surefire.reportsPath" value="${reportsPath}" /&gt; &lt;property name="sonar.core.codeCoveragePlugin" value="jacoco" /&gt; &lt;property name="sonar.jacoco.itReportPath" value="${jacocoCoveragePath}/jacoco.exec" /&gt; &lt;!-- Add the Sonar task --&gt; &lt;taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"&gt; &lt;classpath path="${antLibPath}/sonar-ant-task-1.4.jar" /&gt; &lt;/taskdef&gt; &lt;sonar:sonar key="projectKey" version="1.0" xmlns:sonar="antlib:org.sonar.ant"/&gt; </code></pre> <p>I have tried to include only "relevant" stuff. I am unsure if the "jacoco:coverage" element is corrent for Selenium tests, but in execution logs it mentions the "agent" so I assume the agent is used here as a proxy too on the Java VM.</p> <p>I'm stuck, please help :)</p> <p><strong>Updated</strong> Here is part of the Sonar output:</p> <pre><code>[sonar:sonar] 08:36:15.619 INFO p.PhasesTimeProfiler - Sensor JaCoCoItSensor... [sonar:sonar] 08:36:15.623 INFO o.s.p.j.JaCoCoPlugin - Analysing [file path omitted]\jacoco.exec [sonar:sonar] 08:36:17.272 INFO p.PhasesTimeProfiler - Sensor JaCoCoItSensor done: 1653 ms </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload