Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To answer questions about where the source and instrumented directories are (these can be switched to whatever your standard directory structure is):</p> <pre><code>&lt;property file="build.properties" /&gt; &lt;property name="source" location="src/main/java" /&gt; &lt;property name="test.source" location="src/test/java" /&gt; &lt;property name="target.dir" location="target" /&gt; &lt;property name="target" location="${target.dir}/classes" /&gt; &lt;property name="test.target" location="${target.dir}/test-classes" /&gt; &lt;property name="instr.target" location="${target.dir}/instr-classes" /&gt; </code></pre> <p>Classpaths:</p> <pre><code>&lt;path id="compile.classpath"&gt; &lt;fileset dir="lib/main"&gt; &lt;include name="*.jar" /&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;path id="test.compile.classpath"&gt; &lt;path refid="compile.classpath" /&gt; &lt;pathelement location="lib/test/junit-4.6.jar" /&gt; &lt;pathelement location="${target}" /&gt; &lt;/path&gt; &lt;path id="junit.classpath"&gt; &lt;path refid="test.compile.classpath" /&gt; &lt;pathelement location="${test.target}" /&gt; &lt;/path&gt; </code></pre> <p>First you need to setup where Ant can find the Emma libraries:</p> <pre><code>&lt;path id="emma.lib" &gt; &lt;pathelement location="${emma.dir}/emma.jar" /&gt; &lt;pathelement location="${emma.dir}/emma_ant.jar" /&gt; &lt;/path&gt; </code></pre> <p>Then import the task:</p> <pre><code>&lt;taskdef resource="emma_ant.properties" classpathref="emma.lib" /&gt; </code></pre> <p>Then instrument the code:</p> <pre><code>&lt;target name="coverage.instrumentation"&gt; &lt;mkdir dir="${instr.target}"/&gt; &lt;mkdir dir="${coverage}"/&gt; &lt;emma&gt; &lt;instr instrpath="${target}" destdir="${instr.target}" metadatafile="${coverage}/metadata.emma" mode="copy"&gt; &lt;filter excludes="*Test*"/&gt; &lt;/instr&gt; &lt;/emma&gt; &lt;!-- Update the that will run the instrumented code --&gt; &lt;path id="test.classpath"&gt; &lt;pathelement location="${instr.target}"/&gt; &lt;path refid="junit.classpath"/&gt; &lt;pathelement location="${emma.dir}/emma.jar"/&gt; &lt;/path&gt; &lt;/target&gt; </code></pre> <p>Then run a target with the proper VM arguments like:</p> <pre><code>&lt;jvmarg value="-Demma.coverage.out.file=${coverage}/coverage.emma" /&gt; &lt;jvmarg value="-Demma.coverage.out.merge=true" /&gt; </code></pre> <p>Finally generate your report:</p> <pre><code>&lt;target name="coverage.report" depends="coverage.instrumentation"&gt; &lt;emma&gt; &lt;report sourcepath="${source}" depth="method"&gt; &lt;fileset dir="${coverage}" &gt; &lt;include name="*.emma" /&gt; &lt;/fileset&gt; &lt;html outfile="${coverage}/coverage.html" /&gt; &lt;/report&gt; &lt;/emma&gt; &lt;/target&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload