Cobertura via Ant

<taskdef classpath="cobertura.jar" resource="" />

<target name="instrument">
  <cobertura-instrument todir="target/instrumented-classes">
    <fileset dir="target/classes">
      <include name="**/*.class"/>

<target name="cover-test" depends="instrument">
  <mkdir dir="${testreportdir}" />
  <junit dir="./" failureproperty="test.failure" printSummary="yes" 
         fork="true" haltonerror="true">
    <!-- Normally you can create this task by copying your existing JUnit
         target, changing its name, and adding these next two lines.
         You may need to change the locations to point to wherever 
         you've put the cobertura.jar file and the instrumented classes. -->
    <classpath location="cobertura.jar"/>
    <classpath location="target/instrumented-classes"/>
      <fileset dir="${libdir}">
        <include name="*.jar" />
      <pathelement path="${testclassesdir}" />
      <pathelement path="${classesdir}" />
    <batchtest todir="${testreportdir}">
      <fileset dir="src/java/test">
        <include name="**/*" />
        <include name="org/jaxen/javabean/*" />

Previous | Next | Top | Cafe con Leche

Copyright 2005 Elliotte Rusty Harold
Last Modified September 14, 2005