


<method
name="getSmbUser" desc="(I)Lcom/hp/saas/smbusermgmt/vo/SMBUserBean;"
line="241">
<counter type="INSTRUCTION" missed="11" covered="0"/>
<counter type="BRANCH" missed="2" covered="0"/>
<counter type="LINE" missed="3" covered="0"/>
<counter type="COMPLEXITY" missed="2" covered="0"/>
<counter type="METHOD" missed="1" covered="0"/></method>
<method name="getSmbUser" desc="(IZ)Lcom/hp/saas/smbusermgmt/vo/SMBUserBean;" line="260">
<counter type="INSTRUCTION" missed="76" covered="0"/>
<counter type="BRANCH" missed="4" covered="0"/>
<counter type="LINE" missed="19" covered="0"/>
<counter type="COMPLEXITY" missed="3" covered="0"/>
<counter type="METHOD" missed="1" covered="0"/></method>
The line coverage result is the same as Sonar.
|
<property name="sonar.dynamicAnalysis" value="reuseReports"
/> <property name="sonar.java.coveragePlugin" value="jacoco" /> <property name="sonar.jacoco.reportPath" value="target/jacoco.exec" /> <target name="sonar-ut"> <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"> <classpath path="/home/build/nara/apache-ant-1.7.0/lib/jacocoant.jar" /> </taskdef> <jacoco:coverage enabled="true" destfile="target/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant"> <junit dir="${junit.src.dir}" fork="yes" printsummary="yes" haltonfailure="no" > <classpath> <path refid="junittest.path" /> <pathelement location="${junit.classes.dir}" /> <path refid="sonar.classpath" /> <fileset refid="sonar.ut.fileset"/> <pathelement path="${basedir}/MPP/WEB-INF/classes" /> <pathelement path="${basedir}/MPP/WEB-INF/classes/mappingsHPSA" /> <pathelement path="${basedir}/MPP/WEB-INF/i18resources" /> <pathelement location="${basedir}/MPP/WEB-INF/junittests/UnitTest-Resources/spring-conf" /> <pathelement location="${sonar.libraries}" /> <path refid="junittest.path" /> </classpath> <formatter type="xml" /> <batchtest fork="yes" todir="${junit.sonar.reports.dir}"> <fileset dir="${junit.src.dir}" includes="**/*Test.java,**/*test.java" defaultexcludes="no"/> </batchtest> </junit> </jacoco:coverage> </target> |
Without having looked too closely, this sounds like a case of sonar seeing different classes than jacoco did. Different compilers, aspects, asm, something like that.
Hope that helps
Henrik
Am 31.10.2013 07:22 schrieb <rell...@gmail.com>:
>
> Hello. I use Jacoco with ant and then use sonar to reuse jacoco.exec to show the result. But the result seems incorrect. What's wrong with it? Who knows?
>
> The following is my result:
>
>
>
>
> The test code is:
> --
> You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
JaCoCo determines code execution with so called probes. Probes are inserted into the control flow at certain positions. Code is considered as executed when a subsequent probe has been executed. In case of exceptions such a sequence of instructions is aborted somewhere in the middle and not marked as executed.
Cheers,