Hi,


Workaround i can see is 

   - Use offline instrumentation 
   <http://www.eclemma.org/jacoco/trunk/doc/offline.html> before you run 
   your tests. This way classes get instrumented by JaCoCo before any runtime 
   modification can take place. Note that in this case the report has to be 
   generated with the *original* classes, not with instrumented ones.

Please share us the example in which offline instrumentation is implemented 
with Ant with reference to my implementation which i shared.






On Wednesday, September 21, 2016 at 7:36:54 PM UTC+5:30, Marc R. Hoffmann 
wrote:
>
> 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+un...@googlegroups.com <javascript:>. 
> > 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/1f37db20-8d8d-4b5a-988a-099722b5452a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to