[prev in list] [next in list] [prev in thread] [next in thread]
List: sonar-user
Subject: Re: [sonar-user] How do I exclude Test modules from the percentage calculation of JaCoCo code covera
From: David Racodon <david.racodon () sonarsource ! com>
Date: 2012-06-29 13:49:43
Message-ID: CA+O9QaKbqkqUTHpD4+6QeXfbUvPvXDsQbWwHiW68heJzkTEF2g () mail ! gmail ! com
[Download RAW message or body]
Hi Daniel,
Thanks for the information.
One more question: how do you know that "The coverage in the test modules
is measured and added to the overall percentage for code coverage."?
Thank you
Regards,
*
*
*David RACODON | **SonarSource
**Senior Consultant*
http://sonarsource.com
On 29 June 2012 13:23, Daniel Warzecha <danowar2k@googlemail.com> wrote:
> Hello David,
>
> our project started as a multi-module Eclipse plugin project. At first
> it didn't use Maven, and local development still doesn't use Maven.
> When we wanted continuous integration and source code analysis, we
> installed Jenkins and Sonar. As both seemed to work better with Maven
> projects, we "converted" our project to Maven, meaning that we added
> POM's for each module and for the project itself and configured
> Jenkins to use these POM's for managing the project.
>
> Our analysis: Jenkins does a checkout over the various project
> modules, both productive code and test code plugins. It does a Maven
> build of the project, using Surefire to do the unit tests. During this
> first phase, JaCoCo also instruments and analyzes the code and
> generates the report.
> During the second phase, Sonar (integrated into Jenkins via the
> appropriate plugin) begins its code analysis, but when calculating
> code coverage, it uses the report JaCoCo generated earlier.
>
> More precisely, our project POM contains
>
> <jacoco-maven-version>0.5.6.201201232323</jacoco-maven-version>
>
> <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
> <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
>
> <sonar.jacoco.reportPath>${project.basedir}/../../target/jacoco.exec</sonar.jacoco.reportPath>
>
> and also
>
> <plugin>
> <groupId>org.jacoco</groupId>
> <artifactId>jacoco-maven-plugin</artifactId>
> <version>${jacoco-maven-version}</version>
> <configuration>
>
> <destFile>${project.basedir}/../../target/jacoco.exec</destFile>
> <excludes>
>
> <exclude>**/uni_leipzig/**</exclude>
>
> <exclude>**/*Test.*</exclude>
>
> <exclude>org/eclipse/uml2/uml/util/UMLSwitch</exclude>
> </excludes>
> </configuration>
> <executions>
> <execution>
> <goals>
> <goal>prepare-agent</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
> God, formatting code in e-mails...I'm sorry if this seems cluttered.
>
> The Sonar version we use is 2.13 .
>
> If any additional info would help you help me, I will gladly provide
> more details.
>
> Thanks in advance,
> Daniel Warzecha
>
> 2012/6/29 David Racodon <david.racodon@sonarsource.com>:
> > Hi Daniel,
> >
> > Just a few question to better understand your context:
> >
> > Your project is not a Maven one but you launch your analysis with the
> Maven
> > bootstrapper, correct?
> > Do you reuse reports that you have generated before or do you make Sonar
> > launch directly JaCoCo?
> > Which version of Sonar do you use?
> >
> > Thank you
> >
> > Regards,
> >
> > David RACODON | SonarSource
> > Senior Consultant
> > http://sonarsource.com
> >
> >
> >
> > On 28 June 2012 11:04, Daniel Warzecha <danowar2k@googlemail.com> wrote:
> >>
> >> Hello,
> >>
> >> we're using a Jenkins/Sonar/JaCoCo combo with a multi-module Eclipse
> >> plugin project.
> >> The tests are separated from the productive code, i.e. the test code
> >> of each productive plugin is in a separate test plugin.
> >>
> >> When analyzing the code with JaCoCo, which is run from the Jenkins
> >> Maven side, the generated report is used by Sonar to display code
> >> coverage.
> >>
> >> Our problem: The code coverage percentage seems to be "wrong". The
> >> coverage in the test modules is measured and added to the overall
> >> percentage for code coverage.
> >> We want to see the coverage for the productive code measured, but not
> >> for the test code.
> >>
> >> How could we make this happen? Exclusions? Options?
> >> And where should we apply the changes? Jenkins Sonar Plugin? The Maven
> >> JaCoCo plugin? In the Sonar settings?
> >>
> >> Best Regards,
> >> Daniel Warzecha
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list, please visit:
> >>
> >> http://xircles.codehaus.org/manage_email
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
[Attachment #3 (text/html)]
Hi Daniel,<div><br></div><div>Thanks for the information.</div><div>One more \
question: how do you know that "The coverage in the test modules is measured and \
added to the overall percentage for code coverage."?</div> \
<div><br></div><div>Thank you</div><div><br></div><div>Regards,<br \
clear="all"><div><span style="font-family:arial,sans-serif"><font \
color="#000000"><font face="arial, \
sans-serif"><font><b><br></b></font></font></font></span></div> <div><span \
style="font-family:arial,sans-serif"><font color="#000000"><font face="arial, \
sans-serif"><font><b>David RACODON | </b></font></font></font><font \
color="#cc0000"><font face="arial, sans-serif"><font><b>SonarSource<br> \
</b></font></font></font><i>Senior Consultant</i></span></div><div><span \
style="font-family:arial,sans-serif"><a href="http://sonarsource.com/" \
style="color:rgb(0,101,204)" target="_blank"><font \
color="#cc0000">http://sonarsource.com</font></a></span></div> <br>
<br><br><div class="gmail_quote">On 29 June 2012 13:23, Daniel Warzecha <span \
dir="ltr"><<a href="mailto:danowar2k@googlemail.com" \
target="_blank">danowar2k@googlemail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Hello David,<br>
<br>
our project started as a multi-module Eclipse plugin project. At first<br>
it didn't use Maven, and local development still doesn't use Maven.<br>
When we wanted continuous integration and source code analysis, we<br>
installed Jenkins and Sonar. As both seemed to work better with Maven<br>
projects, we "converted" our project to Maven, meaning that we added<br>
POM's for each module and for the project itself and configured<br>
Jenkins to use these POM's for managing the project.<br>
<br>
Our analysis: Jenkins does a checkout over the various project<br>
modules, both productive code and test code plugins. It does a Maven<br>
build of the project, using Surefire to do the unit tests. During this<br>
first phase, JaCoCo also instruments and analyzes the code and<br>
generates the report.<br>
During the second phase, Sonar (integrated into Jenkins via the<br>
appropriate plugin) begins its code analysis, but when calculating<br>
code coverage, it uses the report JaCoCo generated earlier.<br>
<br>
More precisely, our project POM contains<br>
<jacoco-maven-version>0.5.6.201201232323</jacoco-maven-version><br>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin><br>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis><br>
<sonar.jacoco.reportPath>${project.basedir}/../../target/jacoco.exec</sonar.jacoco.reportPath><br>
<br>
and also<br>
<br>
<plugin><br>
<groupId>org.jacoco</groupId><br>
\
<artifactId>jacoco-maven-plugin</artifactId><br>
\
<version>${jacoco-maven-version}</version><br> <configuration><br>
\
<destFile>${project.basedir}/../../target/jacoco.exec</destFile><br> \
<excludes><br>
\
<exclude>**/uni_leipzig/**</exclude><br>
\
<exclude>**/*Test.*</exclude><br>
\
<exclude>org/eclipse/uml2/uml/util/UMLSwitch</exclude><br> \
</excludes><br> </configuration><br>
<executions><br>
<execution><br>
<goals><br>
<goal>prepare-agent</goal><br>
</goals><br>
</execution><br>
</executions><br>
</plugin><br>
<br>
God, formatting code in e-mails...I'm sorry if this seems cluttered.<br>
<br>
The Sonar version we use is 2.13 .<br>
<br>
If any additional info would help you help me, I will gladly provide<br>
more details.<br>
<br>
Thanks in advance,<br>
Daniel Warzecha<br>
<br>
2012/6/29 David Racodon <<a \
href="mailto:david.racodon@sonarsource.com">david.racodon@sonarsource.com</a>>:<br>
> Hi Daniel,<br>
><br>
> Just a few question to better understand your context:<br>
><br>
> Your project is not a Maven one but you launch your analysis with the Maven<br>
> bootstrapper, correct?<br>
> Do you reuse reports that you have generated before or do you make Sonar<br>
> launch directly JaCoCo?<br>
> Which version of Sonar do you use?<br>
><br>
> Thank you<br>
><br>
> Regards,<br>
><br>
> David RACODON | SonarSource<br>
> Senior Consultant<br>
> <a href="http://sonarsource.com" target="_blank">http://sonarsource.com</a><br>
><br>
><br>
><br>
> On 28 June 2012 11:04, Daniel Warzecha <<a \
href="mailto:danowar2k@googlemail.com">danowar2k@googlemail.com</a>> wrote:<br> \
>><br> >> Hello,<br>
>><br>
>> we're using a Jenkins/Sonar/JaCoCo combo with a multi-module Eclipse<br>
>> plugin project.<br>
>> The tests are separated from the productive code, i.e. the test code<br>
>> of each productive plugin is in a separate test plugin.<br>
>><br>
>> When analyzing the code with JaCoCo, which is run from the Jenkins<br>
>> Maven side, the generated report is used by Sonar to display code<br>
>> coverage.<br>
>><br>
>> Our problem: The code coverage percentage seems to be "wrong". \
The<br> >> coverage in the test modules is measured and added to the \
overall<br> >> percentage for code coverage.<br>
>> We want to see the coverage for the productive code measured, but not<br>
>> for the test code.<br>
>><br>
>> How could we make this happen? Exclusions? Options?<br>
>> And where should we apply the changes? Jenkins Sonar Plugin? The Maven<br>
>> JaCoCo plugin? In the Sonar settings?<br>
>><br>
>> Best Regards,<br>
>> Daniel Warzecha<br>
>><br>
>> ---------------------------------------------------------------------<br>
>> To unsubscribe from this list, please visit:<br>
>><br>
>> <a href="http://xircles.codehaus.org/manage_email" \
target="_blank">http://xircles.codehaus.org/manage_email</a><br> >><br>
>><br>
><br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe from this list, please visit:<br>
<br>
<a href="http://xircles.codehaus.org/manage_email" \
target="_blank">http://xircles.codehaus.org/manage_email</a><br> <br>
<br>
</blockquote></div><br></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic