On Tuesday, 13 May 2014 10:27:26 UTC+5:30, Marc R. Hoffmann  wrote:
> Hi Aditya,
> 
> 
> 
> did you try to create a coverage report with the JaCoCo report task? 
> 
> Here is an example script:
> 
> 
> 
> http://www.eclemma.org/jacoco/trunk/doc/examples/build/build.xml
> 
> 
> 
> For issues with the Jenkins plugin please ask at the project's mailing list:
> 
> 
> 
>      https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin
> 
> 
> 
> Best regards,
> 
> -marc
> 
> 
> 
> On 12.05.14 13:49, [email protected] wrote:
> 
> > Hi,
> 
> >
> 
> > I am having similar problem as that of saga. I need to include multiple 
> > classes under jacoco:coverage :
> 
> >
> 
> >   <target name="HomepageModelTest.run-jacoco" 
> > depends="HomepageModelTest.instrument">
> 
> >    <jacoco:coverage destfile="${evise.dir}/UI/HomepageModelTest/jacoco.exe">
> 
> >      
> 
> >     <java classname="com.a.b.homepage.model.am.HomepageAMHelper"  
> > fork="true">
> 
> >          <classpath>
> 
> >              <pathelement location="${src.bin.dir}"/>
> 
> >          </classpath>
> 
> >      </java>
> 
> > </jacoco:coverage>
> 
> >    </target>
> 
> >
> 
> >
> 
> > Now here, I have multiple classes under "am" package. However, it is not 
> > able to pickup all the classes if i simply use "am.*".
> 
> >
> 
> > I am using testng through ANT build.xml.
> 
> >
> 
> > My overall aim is to generate jacoco code coverage report[through Jenkins] 
> > but it is showing 0% and with no jacoco.exec getting generated.
> 
> > I know my information is vague, so kindly ask me the details you want to 
> > help me with my trouble.
> 
> > Early response is appreciated.
> 
> >
> 
> > Thanks,
> 
> > Aditya
> 
> >

Hey Marc,

Sorry for late reply, I am posting main parts of my build.xml. Hope it will 
throw some light on my problem....

Jacoco Compile-

<target name="HomepageModelTest.compile"
          description="Compile Java source files"
          depends="HomepageModelTest.clean,HomepageModelTest.init">
    <echo message="****Compiling HomepageModelTest Test Driver 
Classes****"></echo>
    <javac destdir="${test.bin.dir}" classpathref="mainclasspath"
           debug="${javac.debug}" nowarn="${javac.nowarn}"
           deprecation="${javac.deprecation}" encoding="Cp1252" source="1.6"
           target="1.6">
      <src path="${test.src.dir}"/>
    </javac>
  </target>

Jacoco Instrument:-

<target name="HomepageModelTest.instrument" depends="HomepageModelTest.jacoco">
        <jacoco:instrument destdir="${out.instr.dir}">
        <fileset dir="${test.bin.dir}" includes="**/*.class" />
        </jacoco:instrument>
        </target>

Jacoco coverage:-

<target name="HomepageModelTest.run-jacoco" 
depends="HomepageModelTest.instrument">
  <jacoco:coverage destfile="${home.dir}/UI/HomepageModelTest/jacoco.exe">
    
        <java classname="com.a.b.homepage.model.am.HomepageAMHelper"  
fork="true">
        <classpath>
            <pathelement location="${src.bin.dir}"/>
        </classpath>
    </java>
</jacoco:coverage>
  </target>


Jacoco report:-

<target name="HomepageModelTest.jacoco-report" 
depends="HomepageModelTest.run-jacoco">
      <jacoco:report>      
<executiondata>
<file file="${home.dir}/UI/HomepageModelTest/jacoco.exe"/>
</executiondata>          
        <structure name="HomepageModelTest Project">
            <classfiles>
                <fileset dir="${test.bin.dir}"/>
            </classfiles>
            <sourcefiles encoding="UTF-8">
                <fileset dir="${test.src.dir}"/>
            </sourcefiles>
        </structure>                           
        <html destdir="${jacoco.dir}"/>                           
    </jacoco:report>
  </target>

Now when I run this Job in Jenkins, it gives following message in instrument:-
[jacoco:instrument] Instrumented 13 classes to 
/repo/CI/.jenkins/jobs/HomeModel/workspace/Home/UI/HomeModelApp/HomepageModelTest/out_instr_dir

and for jacoco report:-
[jacoco:report] Loading execution data file 
/repo/CI/.jenkins/jobs/HomeModel/workspace/Home/UI/HomepageModelTest/jacoco.exe
[jacoco:report] Writing bundle 'HomepageModelTest Project' with 13 classes



However, I am unable to find any jacoco.exec file creation and the coverage 
report shown through Jenkins is 0%. 

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to