From: bastard m. <bas...@ho...> - 2005-06-15 18:14:07
|
I've been working with getting cobertura reports to generate properly and so far i've noticed that even if i specify the same datafile location for both cobertura-instrument and cobertura-report tags, an additionally coberura.ser file is stored 2 directories up from my basedir. This additional file causes the reports to display 0% (line & branch) coverage. I've haven't had any luck with the cobertura-merge tag, it doesn't seem to be working properly. Anyway I've decided to point to the ser file that is 2 directories up when reporting and just move it to a specified locaiton when done generating the reports. This is a very ugly hack. I was wondering if anyone could help me find a quick and clean way to handle this such that only one file is ever generated in the proper location. Thanks in advance, -B The following is the build target: <target name="junit" description="Run All JUnit Tests" depends="remove-reports"> <!-- <property name="corbertura.file" value="cobertura.ser" /> --> <echo level="info">Deleting Corbertura SER file="${corbertura.file}</echo> <delete file="${corbertura.file}"/> <echo level="info">Deleting Instruments dir="${dir.instruments}"</echo> <delete dir="${dir.instruments}" /> <echo level="info">Making Instruments Dir="${dir.instruments}"</echo> <mkdir dir="${dir.instruments}"/> <echo level="info">Creating Instruments: datafile="${corbertura.file}" todir="${dir.instruments}" </echo> <cobertura-instrument datafile="../../${corbertura.file}" todir="${dir.instruments}"> <fileset dir="${dir.classes}"> <!-- Instrument all the application classes, but don't instrument the test classes. --> <include name="**/*.class" /> <exclude name="**/*Test.class" /> </fileset> </cobertura-instrument> <echo level="info">Running JUnit ${dir.test.classes}</echo> <junit printsummary="yes" haltonerror="${haltonerror}" fork="yes" showoutput="${showoutput}"> <classpath location="${dir.instruments}"/> <classpath location="${dir.classes}"/> <classpath refid="build_classpath"/> <jvmarg value="-Xmx${memoryValue}m"/> <batchtest todir="${dir.reports}" haltonerror="${haltonerror}" fork="yes"> <formatter type="xml"/> <fileset dir="${dir.classes}"> <include name="**/*Test*.class"/> <exclude name="**/*$*.class"/> </fileset> </batchtest> </junit> <echo level="info">Making dir="${dir.reports.artifacts}/cobertura"</echo> <mkdir dir="${dir.reports.artifacts}/cobertura"/> <cobertura-report format="html" datafile="../../${corbertura.file}" srcdir="${dir.src}" destdir="${dir.reports.artifacts}/cobertura"/> <move file="../../cobertura.ser" todir="bin/test/reports/artifacts/cobertura"/> <antcall target="archive"/> </target> _________________________________________________________________ On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement |