Hi,

the JaCoCo agent does not work with frameworks like Powermock which modify the classes under test. Please find a detailed discussion and possible workarounds here:


  http://www.eclemma.org/jacoco/trunk/doc/classids.html

Regards,
-marc

On 2016-09-21 15:13, vijay kumar wrote:
Hi, We have integrated jacoco with our ant project and code coverage
report is not generated for the classes in which we have used
@RunWith(PowerMockRunner.class) (Powermock-mockito-1.5-full.jar)

Request you to refer the below mentioned build.xml configuration
details :

Please inform is there any changes which we need to do in build.xml
file or need to do changes in our junit test files.

<!-- jacoco -->

 <taskdef uri="org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">

         <classpath
path="${basedir}/${ivy.lib}/jacoco-0.7.6/lib/jacocoant.jar"/>

   </taskdef>

 <target name="unit_test" depends="unit_test_compile"

         description="Run junit tests">

     <jacoco:coverage destfile="${coverage.dir}/jacoco.exec"
xmlns:jacoco="org.jacoco.ant">

 <junit fork="yes" forkmode="perBatch" haltonfailure="yes"
printsummary="true">

 <classpath refid="unit.test.classpath" />  <!-- classpath contains
nessary jar files for junit and powermockito -->

 <formatter type="xml"/>

 <batchtest fork="yes" todir="${unit.test.reports}">

 <fileset dir="${unit.test.src}">

 <include name="**/*Test*.java"/>

 <exclude name="**/AllTests.java"/>

 <exclude name="**/TestHelpers.java"/>

 </fileset>

 </batchtest>

 </junit>

     </jacoco:coverage>

 </target>

 <target name="coverage-report" depends="unit_test">

 <jacoco:report xmlns:jacoco="org.jacoco.ant">

         <executiondata>

             <file file="${coverage.dir}/jacoco.exec" />

         </executiondata>

         <structure name="Jacoco">

             <classfiles>

                 <fileset dir="${bin}" />

             </classfiles>

             <sourcefiles encoding="UTF-8">

                 <fileset dir="${src}" />

             </sourcefiles>

         </structure>

         <html destdir="${coverage.report.dir}" />

     </jacoco:report>

 </target>

 --
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/7d2e0d22-6be6-43d4-afe5-e8115d0ecc81%40googlegroups.com
[1].
For more options, visit https://groups.google.com/d/optout.


Links:
------
[1]
https://groups.google.com/d/msgid/jacoco/7d2e0d22-6be6-43d4-afe5-e8115d0ecc81%40googlegroups.com?utm_medium=email&utm_source=footer

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/5b833efaffe07ec0ad1757d2d4283768%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to