Adding EMMA Report

Version 1 by Steve Luo
on May 26, 2008 22:37.


 
compared with
Version 2 by Steve Luo
on May 26, 2008 22:53.


Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 10 changes. View first change.

 To add EMMA report, only need two steps:
 # Generate JUnit *XML* report from [Ant|http://ant.apache.org] or [Maven|http://maven.apache.org] or any other build tools.
  To add [EMMA|http://emma.sourceforge.net] report, only need two steps:
 # Generate EMMA *XML* report from [Ant|http://ant.apache.org] or [Maven|http://maven.apache.org] or any other build tools.
 # Publish EMMA report in the [configuration|Configuration].
  
 h2. Generate EMMA Report
QuickBuild will NOT generate EMMA report automatically, so first make sure the EMMA report is produced by [ANT|http://ant.apache.org] or by any other build tools, the following example shows how to generate EMMA test results by [Ant JUnit task|http://ant.apache.org/manual/OptionalTasks/junit.html]:
  QuickBuild will NOT generate [EMMA|http://emma.sourceforge.net] report automatically, so first make sure the EMMA report is produced by [ANT|http://ant.apache.org] or by any other build tools, the following example shows how to generate EMMA [code coverage|_QuickBuild Glossary#code coverage] by [Ant EMMA task|http://emma.sourceforge.net/reference/ch02s02s02.html]:
  
{code:xml|title=JUnit target in build.xml}
 <target name="junit">
  <junit printsummary="yes" haltonfailure="yes">
  <classpath>
  <pathelement location="${build.tests}"/>
  <pathelement path="${java.class.path}"/>
  </classpath>
  {code:xml|title=EMMA target in build.xml}
 <target name="emma_coverage">
  <emmajava enabled="${emma.enabled}" libclasspathref="emma.lib"
  filter="${emma.filter}" sourcepath="${src.dir}"
  classname="Main" classpathref="run.classpath">
  <arg value="someargvalue" />
  
<formatter type="xml"/> <!-- DO use xml here -->
  
  <batchtest fork="yes" todir="reports/junit">
  <fileset dir="${src.tests}">
  <include name="**/*Test*.java"/>
  <exclude name="**/AllTests.java"/>
  </fileset>
  </batchtest>
  </junit>
   <xml outfile="reports/emma/coverage.xml" />
  </emmajava>
 </target>
 {code}
  
The code snippet will generate the XML reports for each test case, and the reports will be captured to 'reports/junit' directory. You may also want to merge all the test case report by using [Ant JUnitReport task|http://ant.apache.org/manual/OptionalTasks/junitreport.html] like:
 {code:xml|title=JUnitReport task in build.xml}
 <target name="junit">
  <junit>
  ... ...
  </junit>
  The code snippet will generate the XML report for all the source code, a XML report: coverage.xml will be generated in 'reports/emma directory' directory which is relative to the [workspace|_QuickBuild Glossary#workspace] directory.
  
<junitreport todir="${outputdir}">
  <fileset dir="reports/junit">
  <include name="TEST-*.xml"/>
  </fileset>
  <report todir="${outputdir}/html"
  styledir="junitreport"
  format="frames">
  <param name="key1" expression="value1"/>
  <param name="key2" expression="value2"/>
  </report>
  </junitreport>
 </target>
 {code}
  After adding generate the XML code coverage report for your source code, you can tell QuickBuild to add those results now.
  
After adding generate the XML report(s) for your test results, you can tell QuickBuild to add those results now.
  h2. Publish EMMA Report
 Just like all other [build reports|Publishing Build Reports], to add EMMA report is by [adding a publish step|Add Step] in a [configuration|Configuration]. When you add publish JUnit Report step, the following screen will be displayed:
  
h2. Publish JUnit Report
 Just like all other [build reports|Publishing Build Reports], to add JUnit report is by [adding a publish step|Add Step] in a [configuration|Configuration]. When you add publish JUnit Report step, the following screen will be displayed:
  !emma_step.png!
  
!junit_step.png!
  
 In source files field, QuickBuild use Ant style file patterns to collect the reports, and the directory you specified is *relative* to the [workspace|Workspace Directory] directory.
  
 {info:title=More on JUnit Report}
 * If you have merged all test reports into one report using JUnitReport task, and the merged report is in the same directory as those test cases reports, please DO specify the merged report only.
 {info}