Hi,

one problem I spot immediately is the includes filter:

    includes="**/*.class"

The filter refers to VM class name, not class files. If you want to cover all classes the correct syntax is

    includes="*"

Which is default anyways.

regrads,
-marc


On 2015-06-18 13:31, [email protected] wrote:
We are in the process of measuring code coverage for Selenium UI
functional tests using Jacoco having ANT build. TestNG framework has
been used to manage and trigger selenium test cases. we are using
[JDK:1.6], [ANT:1.7.1], [jacoco: 0.7.5] and Web-application runs on
"Websphere.

Note: Script compiles the project first and then triggers the selenium
tests against the application from compiled code-base.

Please refer the below script and let us know, where and what are we
doing the mistake.
-----------------------------Script Begins-----------------------------

<?xml version="1.0" encoding="UTF-8"?>
<project name="Ant file for TestNG" default="all" basedir="."
xmlns:sonar="antlib:org.sonar.ant"
xmlns:jacoco="antlib:org.jacoco.ant">
        
<taskdef resource="net/sf/ant4eclipse/antlib.xml" />

        <path id="class.path">
                <fileset dir="${lib.dir}">
                        <include name="**/*.jar" />
                </fileset>
                <pathelement location="${bin.dir}" />
        </path>
        <target name="clean">
                <delete dir="${build.dir}" />
                <delete dir="${it.test.report.dir}" />
        </target>

        <target name="init">            
                <mkdir dir="${it.test.report.dir}" />
        </target>

<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
      <classpath path="X:/.../.../.../.../jacocoant.jar"/>
      <classpath path="X:/.../.../.../.../jacocoagent.jar"/>
</taskdef>

<taskdef name="testng" classname="org.testng.TestNGAntTask"
classpathref="class.path">
</taskdef>        

<target name="report">

<jacoco:agent property="agentvmparam"
destfile="X:/.../.../.../.../jacoco.exec" includes="**/*.class"
output="file" dumponexit="true"
classdumpdir="X:/.../.../.../.../jclasses"/>

<jacoco:coverage>                 
 <testng haltonfailure="yes" classpathref="class.path">
 <xmlfileset dir="." includes="Demotestng.xml" />
 <classpath refid="class.path" />                               
 <jvmarg value="-Xshareclasses:none"/>
 <jvmarg value="${agentvmparam}"/>
 </testng>
</jacoco:coverage>        
                

<jacoco:report>
 <executiondata>
  <file file="X:/.../.../.../.../jacoco.exec"/>
 </executiondata>

 <structure name="Example Integration Test Project">
 <classfiles>
  <fileset dir="X:/.../.../.../.../servlets">                                   
  <include name="**/*.class" />                                         
  </fileset>
 </classfiles>
 <sourcefiles encoding="UTF-8">
<fileset dir="X:/.../.../src/.../.../servlets">
<include name="**/*.java" />
</fileset>
</sourcefiles>
                                
</structure>
 <html destdir="jreport" />
</jacoco:report>
</target> 

<target name="all" depends="clean,compilepresentation,report" />

</project>
--------------- Script Ends---------------------------------------

Made all the required changes and continuously trying with potential
changes. However, unable to meet the objective of getting the coverage
report.

Report generated as "Missed Instructions: All(RED Horizontal pipe),
Coverage:0%::  Missed branchess: All(RED Horizontal pipe),
Coverage:0%"

Kindly help me on this, it's been a week, we're unable to reach the goal.

Thanks

--
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/59b9cd8ac796abf01b419597968a3744%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to