Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>cobertura can't look into integration test to see code coverage.</p> <p>Try a look at <a href="http://www.sonarsource.org/measure-coverage-by-integration-tests-with-sonar-updated/" rel="nofollow">code coverage by integration tests with sonar</a> and at <a href="http://java.dzone.com/articles/separating-integration-and" rel="nofollow">separating integration and unit tests</a></p> <p>To make a short story : you must launch the jacoco maven plugin who will set two properties, one for unit tests, the another for it tests, and launch surefire and failsafe with these properties.</p> <p>And after, you can show result in sonar in separated applet. </p> <p>In my own pom file, you will se a part for enabled jacoco :</p> <pre><code> &lt;properties&gt; &lt;!-- Coverage and report --&gt; &lt;jacoco.destFile.unit&gt;${project.build.directory}/jacoco-unit.target&lt;/jacoco.destFile.unit&gt; &lt;jacoco.destFile.it&gt;${project.build.directory}/jacoco-it.target&lt;/jacoco.destFile.it&gt; &lt;coverage.reports.dir&gt;${project.build.directory}/coverage-reports&lt;/coverage.reports.dir&gt; &lt;version.surefire&gt;2.12.4&lt;/version.surefire&gt; &lt;!-- Sonar --&gt; &lt;sonar.jacoco.itReportPath&gt;${jacoco.destFile.it}&lt;/sonar.jacoco.itReportPath&gt; &lt;sonar.jacoco.reportPath&gt;${jacoco.destFile.unit}&lt;/sonar.jacoco.reportPath&gt; &lt;sonar.core.codeCoveragePlugin&gt;jacoco&lt;/sonar.core.codeCoveragePlugin&gt; &lt;sonar.dynamicAnalysis&gt;reuseReports&lt;/sonar.dynamicAnalysis&gt; &lt;/properties&gt; &lt;build&gt; .... &lt;plugins&gt; &lt;!-- Jacoco configuration --&gt; &lt;plugin&gt; &lt;groupId&gt;org.jacoco&lt;/groupId&gt; &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt; &lt;version&gt;0.6.0.201210061924&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;prepare-agent&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;propertyName&gt;jacoco.argLine.unit&lt;/propertyName&gt; &lt;destFile&gt;${jacoco.destFile.unit}&lt;/destFile&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;pre-integration-test&lt;/id&gt; &lt;phase&gt;pre-integration-test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;prepare-agent&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;propertyName&gt;jacoco.argLine.it&lt;/propertyName&gt; &lt;destFile&gt;${jacoco.destFile.it}&lt;/destFile&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;!-- And in the surefire and failsafe plugins you need to enable jacoco like this -&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;version&gt;${version.surefire}&lt;/version&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt; &lt;artifactId&gt;surefire-junit47&lt;/artifactId&gt; &lt;version&gt;${version.surefire}&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;configuration&gt; &lt;argLine&gt;${jacoco.argLine.unit} -Dfile.encoding=${project.build.sourceEncoding} -Xmx512m&lt;/argLine&gt; &lt;forkMode&gt;always&lt;/forkMode&gt; &lt;parallel&gt;classes&lt;/parallel&gt; &lt;/configuration&gt; &lt;/plugin--&gt; &lt;!-- Play the /src/test/java/**IT.java with goal verify --&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt; &lt;version&gt;${version.surefire}&lt;/version&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt; &lt;artifactId&gt;surefire-junit47&lt;/artifactId&gt; &lt;version&gt;${version.surefire}&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;configuration&gt; &lt;forkMode&gt;pertest&lt;/forkMode&gt; &lt;reportsDirectory&gt;${project.build.directory}/surefire-reports&lt;/reportsDirectory&gt; &lt;argLine&gt;${jacoco.argLine.it} -Dfile.encoding=${project.build.sourceEncoding} -Xmx512m&lt;/argLine&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;integration-test&lt;/id&gt; &lt;phase&gt;integration-test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;integration-test&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;verify&lt;/id&gt; &lt;phase&gt;verify&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;verify&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>In Jenkins, you must setup the "postbuild" JaCoCo plugins with "**/**.target" for path to exec files</p> <p>Hope this will help you.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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