-
Bug
-
Resolution: Fixed
-
Critical
-
None
-
Platform: All, OS: All
The cobertura plugin claims that it can't find the source code for a HTML
report, but other parts of the report generation are working.
Following project strucure and settings (with cobertura 1.9, hudson 1.142,
cobertura plugin 0.8 ) (inspired by
http://weblogs.java.net/blog/fabriziogiudici/archive/2006/11/setting_up_netb.html)
Hudson configure:
JavaApplication5/build/test/results/coverage.xml
build.properties
================
C:\Dokumente und Einstellungen\my_name\.netbeans\5.5.1\build.properties
cobertura.home=D\:\\Programme\\Java
cobertura-1.9
cobertura.jar=${cobertura.home}/cobertura.jar
cobertura.instrumented=/instrumented-classes
project.properties
==================
C:\Dokumente und
Einstellungen\my_name\.hudson\jobs\JavaApplikation\workspace\JavaApplication5\nbproject\project.properties
run.test.classpath=\
${cobertura.jar}:\
${build.dir}${cobertura.instrumented}:\
${javac.test.classpath}:\
${build.test.classes.dir}
build.xml
=========
C:\Dokumente und
Einstellungen\my_name\.hudson\jobs\JavaApplikation\workspace\JavaApplication5\build.xml
<import file="nbproject/private/ci.xml" optional="true"/>
<target name="-init-macrodef-junit">
<echo>My junit was called! ${run.test.classpath}</echo>
<!-<property file="${user.properties.file}"/>->
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute name="includes" default="**/*Test.java"/>
<sequential>
<junit showoutput="true" fork="true" dir="${basedir}"
failureproperty="tests.failed" errorproperty="tests.failed">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" includes="@
"/>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper type="glob" from="test-sys-prop." to=""/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${run.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
ci.xml
======
C:\Dokumente und
Einstellungen\my_name\.hudson\jobs\JavaApplikation\workspace\JavaApplication5\nbproject\private\ci.xml
<target name="cobertura-instrument" depends="init,compile-test,-pre-test-run">
<property file="nbproject/project.properties" />
<!-<property file="nbproject/private/ci.properties" />->
<path id="cobertura.classpath">
<fileset dir="${cobertura.home}">
<include name="cobertura.jar" />
<include name="lib/*/.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<cobertura-instrument todir="${build.dir}/instrumented-classes">
<fileset dir="${build.classes.dir}">
<include name="*/.class"/>
</fileset>
</cobertura-instrument>
</target>
<target name="test-coverage"
depends="init,compile-test,-pre-test-run,cobertura-instrument,-do-test-run,test-report,-post-test-run,-test-browse"/>
<target name="cobertura-coverage-report" depends="test-coverage">
<property file="nbproject/project.properties"/>
<!--<path id="cobertura.classpath">
<fileset dir="${cobertura.home}">
<include name="cobertura.jar" />
<include name="lib/*/.jar" />
</fileset>
</path>-->
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<cobertura-report classpathref="cobertura.classpath" format="xml"
srcdir="${src.dir}" destdir="${build.dir}/test/results" />
<cobertura-report classpathref="cobertura.classpath" format="html"
srcdir="${src.dir}" destdir="${build.dir}/test/results" /><!-- I've tested
several settings here! -->
<delete file="cobertura.ser" />
<delete dir="${build.dir}/instrumented-classes" />
</target>
Project structure for hudson
============================
C:\Dokumente und Einstellungen\my_name\.hudson
jobs
+ JavaApplikation
+ builds
+ cobertura (tested with this location too)
+ javadoc
+ workspace
+ JavaApplication5
+ build
+ classes
+ test
+ classes
+ instrumented-classes
+ results (where I put the report initially)
+ dist
+ nbproject
+ private
+ src
+ test