View Source

To publish [EMMA|] report, you only need two steps:
# Generate EMMA *XML* report from [Ant|] or [Maven|] or any other build tool.
# Add EMMA publish step by choosing _Publish -> EMMA Report_ from the step menu.

h2. Generate EMMA Report

QuickBuild will NOT generate [EMMA|] report automatically, so first make sure that the EMMA report is produced by [ANT|] or by any other build tool. The following example shows how to generate EMMA [code coverage|Concepts#code coverage] with [Ant EMMA task|]:
{code:xml|title=EMMA target in build.xml}
<target name="emma.instr" depends="clean, compile.tests" if="emma.enabled">
<available file="lib/emma.jar" property="emma.available"/>
<fail unless="emma.available" message="Error: emma.jar not found" />
<path id="emma.lib.dir">
<pathelement location="${lib.dir}/emma.jar" />
<pathelement location="${lib.dir}/emma_ant.jar" />

<taskdef resource="" classpathref="emma.lib.dir" />
<mkdir dir="${}" />
<instr instrpath="${build.home}/classes"
merge="true" mode="overwrite" />

<!-- Run all the JUnit Tests -->
<target name="junit" depends="emma.instr">
<mkdir dir="${}" />
<mkdir dir="${}/test-out" />
<record name="${}/test-output.txt" append="no" action="start"/>
<junit printsummary="yes" haltonfailure="false" fork="yes">
<jvmarg value="-Demma.coverage.out.file=${}/coverage.emma" />
<jvmarg value="-Demma.coverage.out.merge=true" />

<classpath refid="test.classpath"/>
<!-- <formatter type="plain"/> -->
<formatter type="xml"/>
<batchtest fork="yes" todir="${}/test-out">
<fileset dir="${test.home}">
<include name="**/*"/>
<exclude name="**/*"/>
<junitreport todir="${}">
<fileset dir="${}/test-out">
<include name="TEST-*.xml"/>
<record name="${}/test-output.txt" action="stop"/>

<!-- Generate Emma Report -->
<target name="" depends="junit" if="emma.enabled">
<emma enabled="true">
<report sourcepath="${dir.src}"
<fileset dir="${}">
<include name="*.emma" />
<xml outfile="${}/coverage.xml" depth="method" />

<!-- deleted the instrumented .class files -->
<!-- <delete dir="${build.home}/classes" /> -->
The code snippet will generate the XML report for all the source code. XML report coverage.xml will be generated in 'reports/emma directory' directory which is relative to the [workspace|Concepts#workspace] directory.

After adding the target above, generate the XML code coverage report for your source code, and after that you can tell QuickBuild to publish the results.

h2. Publish EMMA Report
Add _*Publish EMMA Report*_ step to your build workflow. If you have several report sets, you can add several steps with different report set names. Reference [this page|Publish Build Reports] for more details.