Link to home
Start Free TrialLog in
Avatar of ptmcomp
ptmcompFlag for Switzerland

asked on

Creating Cobertura report with Ant

Hi experts!

I'm trying to create a cobertura report with ant. I tried all the examples from the web but I'm always getting a 0% coverage report.
I'm using Ant 1.6.5, JUnit 3.8.1 and cobertura 1.8
The JUnit test report shows that the tests were executed and successfull. The cobertura report shows the right class, but 0% coverage. I also tried to delete the original classes or overwrite them with the instrumented classes - no change...

My build.xml file looks like this:

<?xml version="1.0"?>
<project name="CoberturaAntScript" default="all" basedir=".">
      <description>
            Tests the creation of a Cobertura report
    </description>

      <!-- set global properties for this build -->
      <property name="src" location="src" />
      <property name="libs" location="." />
      <property name="src.tests" location="test" />
      <property name="build" location="build" />
      <property name="build.instrumented" location="build-instrumented" />
      <property name="cobertura.ser" location="D:/Data/Code/Java/TestProjects/CoberturaTest/CoberturaTest/reports/cobertura.ser" />
      <property name="build.tests" location="build.tests" />
      <property name="reports" location="./reports" />
      <property name="reports.tests.html" location="${reports}/unit-tests/html" />
      <property name="reports.tests.xml" location="${reports}/unit-tests/xml" />
      <property name="reports.coveragereport" location="reports/coveragereport" />
      <property name="dist" location="dist" />

      <property name="cobertura.dir" value="D:/Data/Code/Java/sourceforge/cobertura/cobertura-1.8" />

      <path id="cobertura.classpath">
            <fileset dir="${cobertura.dir}">
                  <include name="cobertura.jar" />
                  <include name="lib/**/*.jar" />
            </fileset>
      </path>

      <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

      <path id="classpath.base">
            <path refid="cobertura.classpath" />
            <fileset dir="${libs}">
                  <include name="**/*.jar" />
            </fileset>
      </path>
      <path id="classpath.test">
            <path refid="classpath.base" />
            <pathelement location="${build}" />
            <pathelement location="${build.tests}" />
            <pathelement location="D:/Data/Code/Java/apache/apache-ant-1.6.5/lib/junit.jar" />
            <pathelement location="D:/Data/Code/Java/apache/apache-ant-1.6.5/lib/ant-junit.jar" />
      </path>


      <target name="init">
            <!-- Create the time stamp -->
            <tstamp />
            <!-- Create the build directory structure used by compile -->
            <mkdir dir="${build}" />
            <mkdir dir="${build.tests}" />
            <mkdir dir="${reports}" />
            <mkdir dir="${dist}" />
      </target>

      <target name="compile" depends="init" description="compile the source ">
            <!-- Compile the java code from ${src} into ${build} -->
            <javac srcdir="${src}" destdir="${build}" classpathref="classpath.base" debug="true">
                  <include name="**/*.java" />
            </javac>
      </target>

      <target name="compile-tests" depends="init" description="compile the source ">
            <javac srcdir="${src.tests}" destdir="${build.tests}" classpathref="classpath.test" debug="true">
                  <include name="**/*Test*.java" />
            </javac>
      </target>

      <target name="cobertura-instrument" depends="compile-tests">
            <delete file="${cobertura.ser}" />
            <delete dir="${build.instrumented}" />
            <cobertura-instrument datafile="${cobertura.ser}" todir="${build.instrumented}">
                  <ignore regex="org.apache.log4j.*" />
                  <fileset dir="${build}">
                        <include name="**/*.class" />
                  </fileset>
                  <!--
                  <fileset dir="${libs}">
                        <include name="my-own-library.jar" />
                  </fileset>
                  -->
            </cobertura-instrument>
      </target>

      <target name="unit-test" depends="cobertura-instrument">
            <mkdir dir="${reports.tests.xml}" />
            <junit fork="yes" printsummary="yes" haltonfailure="yes">
                  <sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.ser}" />
                  <classpath refid="cobertura.classpath" />
                  <classpath location="${build.instrumented}" />
                  <classpath location="${build.tests}" />

                  <batchtest fork="yes" todir="${reports.tests.xml}">
                        <fileset dir="${build.tests}">
                              <include name="**/*Test*.class" />
                        </fileset>
                        <formatter type="xml" usefile="true" />
                  </batchtest>
            </junit>
      </target>

      <target name="unit-test-report">
            <mkdir dir="${reports.tests.html}" />
            <junitreport todir="${reports.tests.xml}">
                  <fileset dir="${reports.tests.xml}">
                        <include name="TEST-*.xml" />
                  </fileset>
                  <report format="noframes" todir="${reports.tests.html}" />
            </junitreport>
      </target>

      <target name="cobertura-report">
            <cobertura-report format="html" datafile="${cobertura.ser}" destdir="${reports.coveragereport}" srcdir="${src}" />
      </target>

      <target name="dist" depends="compile" description="generate the distribution">
            <!-- Create the distribution directory -->
            <mkdir dir="${dist}/lib" />

            <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
            <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}" />
      </target>


      <target name="clean" description="clean up">
            <delete dir="${build}" />
            <delete dir="${build.instrumented}" />
            <delete dir="${build.tests}" />
            <delete dir="${reports}" />
            <delete dir="${dist}" />
      </target>
      
      <target name="all" depends="clean,init,compile,compile-tests,cobertura-instrument,unit-test,unit-test-report,cobertura-report" />
</project>

I would appreciate any hint.

Thank you

René Grob
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ptmcomp

ASKER

Well, here is the output: (The result is still the same)

Apache Ant version 1.6.5 compiled on June 2 2005
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\Java\jdk1.5.0_04\jre
Detected OS: Windows XP
parsing buildfile D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.xml with URI = file:///D:/Data/Code/Java/TestProjects/CoberturaTest/CoberturaTest/build.xml
Project base dir set to: D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest
Build sequence for target(s) `all' is [clean, init, compile, compile-tests, cobertura-instrument, unit-test, unit-test-report, cobertura-report, all]
Complete build sequence is [clean, init, compile, compile-tests, cobertura-instrument, unit-test, unit-test-report, cobertura-report, all, tests-only, prepare, dist, ]

clean:
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build\com\mycompany\myproject\Class1.class
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build\com\mycompany\myproject
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build\com\mycompany
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build\com
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented\com\mycompany\myproject\Class1.class
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented\com\mycompany\myproject
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented\com\mycompany
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented\com
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests\com\mycompany\myproject\test\Class1Test.class
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests\com\mycompany\myproject\test
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests\com\mycompany\myproject
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests\com\mycompany
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests\com
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\cobertura.ser
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\com.mycompany.myproject.Class1.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\css\help.css
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\css\main.css
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\css\sortabletable.css
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\css\source-viewer.css
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\css\tooltip.css
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\css
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\frame-packages.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\frame-sourcefiles-com.mycompany.myproject.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\frame-sourcefiles.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\frame-summary-com.mycompany.myproject.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\frame-summary.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\help.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\images\blank.png
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\images\downsimple.png
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\images\upsimple.png
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\images
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\index.html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\js\customsorttypes.js
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\js\popup.js
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\js\sortabletable.js
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\js\stringbuilder.js
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport\js
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\coveragereport
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\html\junit-noframes.html
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\html
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\xml\TEST-com.mycompany.myproject.test.Class1Test.xml
   [delete] Deleting D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\xml\TESTS-TestSuites.xml
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\xml
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\dist
   [delete] Deleting directory D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\dist

init:
    [mkdir] Created dir: D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build
    [mkdir] Created dir: D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests
    [mkdir] Created dir: D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports
    [mkdir] Created dir: D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\dist

compile:
    [javac] com\mycompany\myproject\Class1.java added as com/mycompany/myproject/Class1.class doesn't exist.
    [javac] Compiling 1 source file to D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build
    [javac] Using modern compiler
    [javac] Compilation arguments:
    [javac] '-d'
    [javac] 'D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build'
    [javac] '-classpath'
    [javac] 'D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\cobertura.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\asm-2.2.1.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\jakarta-oro-2.0.8.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\log4j-1.2.9.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-launcher.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-antlr.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-bcel.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-bsf.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-log4j.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-oro.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-regexp.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-resolver.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-commons-logging.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-commons-net.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-icontract.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jai.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-javamail.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jdepend.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jmf.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jsch.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-junit.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-netrexx.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-nodeps.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-starteam.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-stylebook.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-swing.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-trax.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-vaj.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-weblogic.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-xalan1.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-xslp.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\junit.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\xercesImpl.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\xml-apis.jar;C:\Java\jdk1.5.0_04\lib\tools.jar'
    [javac] '-sourcepath'
    [javac] 'D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\src'
    [javac] '-g'
    [javac]
    [javac] The ' characters around the executable and arguments are
    [javac] not part of the command.
    [javac] File to be compiled:
    [javac]     D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\src\com\mycompany\myproject\Class1.java

compile-tests:
    [javac] com\mycompany\myproject\test\Class1Test.java added as com/mycompany/myproject/test/Class1Test.class doesn't exist.
    [javac] Compiling 1 source file to D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests
    [javac] Using modern compiler
    [javac] Compilation arguments:
    [javac] '-d'
    [javac] 'D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests'
    [javac] '-classpath'
    [javac] 'D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\cobertura.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\asm-2.2.1.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\jakarta-oro-2.0.8.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\log4j-1.2.9.jar;D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\junit.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-junit.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-launcher.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-antlr.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-bcel.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-bsf.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-log4j.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-oro.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-regexp.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-apache-resolver.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-commons-logging.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-commons-net.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-icontract.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jai.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-javamail.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jdepend.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jmf.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-jsch.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-netrexx.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-nodeps.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-starteam.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-stylebook.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-swing.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-trax.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-vaj.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-weblogic.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-xalan1.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-xslp.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\xercesImpl.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\xml-apis.jar;C:\Java\jdk1.5.0_04\lib\tools.jar'
    [javac] '-sourcepath'
    [javac] 'D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\test'
    [javac] '-g'
    [javac]
    [javac] The ' characters around the executable and arguments are
    [javac] not part of the command.
    [javac] File to be compiled:
    [javac]     D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\test\com\mycompany\myproject\test\Class1Test.java

cobertura-instrument:
   [delete] Could not find file D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\cobertura.ser to delete.
Adding com\mycompany\myproject\Class1.class to list
[cobertura-instrument] Executing 'C:\Java\jdk1.5.0_04\jre\bin\java.exe' with arguments:
[cobertura-instrument] '-classpath'
[cobertura-instrument] 'D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\cobertura.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\asm-2.2.1.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\jakarta-oro-2.0.8.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\log4j-1.2.9.jar'
[cobertura-instrument] 'net.sourceforge.cobertura.instrument.Main'
[cobertura-instrument] '--commandsfile'
[cobertura-instrument] 'C:\DOKUME~1\rg\LOKALE~1\Temp\cobertura.29595.cmdline'
[cobertura-instrument]
[cobertura-instrument] The ' characters around the executable and arguments are
[cobertura-instrument] not part of the command.
[cobertura-instrument] Cobertura 1.8 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] Instrumenting 1 file to D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented
[cobertura-instrument] Cobertura: Saved information on 1 classes.
[cobertura-instrument] Instrument time: 109ms

unit-test:
    [mkdir] Created dir: D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\xml
    [junit] Implicitly adding D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\junit.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-launcher.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-junit.jar to CLASSPATH
    [junit] Running com.mycompany.myproject.test.Class1Test
    [junit] Executing 'C:\Java\jdk1.5.0_04\jre\bin\java.exe' with arguments:
    [junit] '-Dnet.sourceforge.cobertura.datafile=D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\cobertura.ser'
    [junit] '-classpath'
    [junit] 'D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\cobertura.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\asm-2.2.1.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\jakarta-oro-2.0.8.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\log4j-1.2.9.jar;D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build-instrumented;D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\build.tests;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\junit.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-launcher.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant.jar;D:\Data\Code\Java\apache\apache-ant-1.6.5\lib\ant-junit.jar'
    [junit] 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
    [junit] 'com.mycompany.myproject.test.Class1Test'
    [junit] 'filtertrace=true'
    [junit] 'haltOnError=false'
    [junit] 'haltOnFailure=true'
    [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
    [junit] 'showoutput=false'
    [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\xml\TEST-com.mycompany.myproject.test.Class1Test.xml'
    [junit] 'propsfile=D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\junit2059163631.properties'
    [junit]
    [junit] The ' characters around the executable and arguments are
    [junit] not part of the command.
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.047 sec

unit-test-report:
    [mkdir] Created dir: D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\html
[junitreport] Parsing file: 'D:\Data\Code\Java\TestProjects\CoberturaTest\CoberturaTest\reports\unit-tests\xml\TEST-com.mycompany.myproject.test.Class1Test.xml'
[junitreport] Using com.sun.org.apache.xalan.internal.xsltc Java Runtime Environment 1.5.0_04
[junitreport] Transform time: 500ms

cobertura-report:
[cobertura-report] Executing 'C:\Java\jdk1.5.0_04\jre\bin\java.exe' with arguments:
[cobertura-report] '-classpath'
[cobertura-report] 'D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\cobertura.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\asm-2.2.1.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\jakarta-oro-2.0.8.jar;D:\Data\Code\Java\sourceforge\cobertura\cobertura-1.8\lib\log4j-1.2.9.jar'
[cobertura-report] 'net.sourceforge.cobertura.reporting.Main'
[cobertura-report] '--commandsfile'
[cobertura-report] 'C:\DOKUME~1\rg\LOKALE~1\Temp\cobertura.29596.cmdline'
[cobertura-report]
[cobertura-report] The ' characters around the executable and arguments are
[cobertura-report] not part of the command.
[cobertura-report] Cobertura 1.8 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-report] Cobertura: Loaded information on 1 classes.
[cobertura-report] Report time: 391ms

all:

BUILD SUCCESSFUL
Total time: 4 seconds
Avatar of ptmcomp

ASKER

Sometimes the problem is sitting in front of the computer screen...
Well, the ant script is fine - just the test methods were commented out, so there was actually 0% coverage! I wasted so much time with this!

Anyway thank you for your help!

René
Yes, it helps when you run in debug mode ;-)