From: Mark D. <Mar...@sa...> - 2005-06-15 18:22:45
|
It sounds like you need to pass a sysproperty to the Junit task that = specifies the location of the cobertura.ser file. Something like <junit ...> <sysproperty key=3D"net.sourceforge.cobertura.datafile" value=3D"${cobertura.file}"/> </junit> Also, the merge tasks has problems in Cobertura 1.3. It should be a = better in CVS, but could still use some more testing. -Mark =20 > -----Original Message----- > From: cob...@li...=20 > [mailto:cob...@li...] On=20 > Behalf Of bastard metheus > Sent: Wednesday, June 15, 2005 2:14 PM > To: Cob...@li... > Subject: [Cobertura-devel] duplicate copies of cobertura.ser file?? >=20 > I've been working with getting cobertura reports to generate=20 > properly and so=20 > far i've noticed that even if i specify the same datafile=20 > location for both=20 > cobertura-instrument and cobertura-report tags, an=20 > additionally coberura.ser=20 > file is stored 2 directories up from my basedir. This=20 > additional file causes=20 > the reports to display 0% (line & branch) coverage. I've=20 > haven't had any=20 > luck with the cobertura-merge tag, it doesn't seem to be=20 > working properly.=20 > Anyway I've decided to point to the ser file that is 2=20 > directories up when=20 > reporting and just move it to a specified locaiton when done=20 > generating the=20 > reports. This is a very ugly hack. I was wondering if anyone=20 > could help me=20 > find a quick and clean way to handle this such that only one=20 > file is ever=20 > generated in the proper location. >=20 > Thanks in advance, > -B >=20 > The following is the build target: >=20 > <target name=3D"junit" description=3D"Run All JUnit Tests" > depends=3D"remove-reports"> >=20 > <!-- > <property name=3D"corbertura.file" value=3D"cobertura.ser" /> > --> > <echo level=3D"info">Deleting Corbertura SER=20 > file=3D"${corbertura.file}</echo> > <delete file=3D"${corbertura.file}"/> > <echo level=3D"info">Deleting Instruments=20 > dir=3D"${dir.instruments}"</echo> > <delete dir=3D"${dir.instruments}" /> >=20 > <echo level=3D"info">Making Instruments=20 > Dir=3D"${dir.instruments}"</echo> > <mkdir dir=3D"${dir.instruments}"/> >=20 > <echo level=3D"info">Creating Instruments:=09 > datafile=3D"${corbertura.file}"=20 > todir=3D"${dir.instruments}" > </echo> >=20 > <cobertura-instrument datafile=3D"../../${corbertura.file}"=20 > todir=3D"${dir.instruments}"> > <fileset dir=3D"${dir.classes}"> > <!-- > Instrument all the application=20 > classes, but > don't instrument the test classes. > --> > <include name=3D"**/*.class" /> > <exclude name=3D"**/*Test.class" /> > </fileset> > </cobertura-instrument> >=20 > <echo level=3D"info">Running JUnit ${dir.test.classes}</echo> > <junit printsummary=3D"yes" haltonerror=3D"${haltonerror}"=20 > fork=3D"yes" > showoutput=3D"${showoutput}"> > <classpath location=3D"${dir.instruments}"/> > <classpath location=3D"${dir.classes}"/> > <classpath refid=3D"build_classpath"/> > <jvmarg value=3D"-Xmx${memoryValue}m"/> >=20 > <batchtest todir=3D"${dir.reports}" > haltonerror=3D"${haltonerror}" fork=3D"yes"> > <formatter type=3D"xml"/> > <fileset dir=3D"${dir.classes}"> > <include name=3D"**/*Test*.class"/> > <exclude name=3D"**/*$*.class"/> > </fileset> > </batchtest> > </junit> >=20 > <echo level=3D"info">Making=20 > dir=3D"${dir.reports.artifacts}/cobertura"</echo> > <mkdir dir=3D"${dir.reports.artifacts}/cobertura"/> > <cobertura-report format=3D"html"=20 > datafile=3D"../../${corbertura.file}" > srcdir=3D"${dir.src}" > destdir=3D"${dir.reports.artifacts}/cobertura"/> >=20 > <move file=3D"../../cobertura.ser"=20 > todir=3D"bin/test/reports/artifacts/cobertura"/> >=20 > <antcall target=3D"archive"/> > </target> |