From: Grzegorz L. <ha...@gm...> - 2005-06-20 20:17:43
|
Hi I admit that I do not like this solution too much. I think it should not be implemented. But to defend it a little, I was thinking of this behaviour: 1) Check if net.something system property is set, and if so - use it 2) If there is no such system property then use hardcoded path It could be useful for first time users, that was the idea.=20 Grzegorz On 6/20/05, Mark Doliner <Mar...@sa...> wrote: > Currently a log4j "info" message is printed, but that's all. Printing a = warning or an error isn't quite correct, because technically it should be o= k to create a new cobertura.ser file when running your tests. Technically = users should be able to create cobertura.ser's all over the place and then = merge them into one big file at the end when they want to generate their re= ports. >=20 > For this same reason, hard coding the location to cobertura.ser as part o= f the instrumentation may not be a good idea. What if people want to copy = their instrumented code to other machines? Or even other architectures? T= he location would likely be different when running on a different system. >=20 > -Mark >=20 > > -----Original Message----- > > From: cob...@li... > > [mailto:cob...@li...] On > > Behalf Of Grzegorz Lukasik > > Sent: Wednesday, June 15, 2005 4:19 PM > > To: Cob...@li... > > Subject: Re: [Cobertura-devel] duplicate copies of > > cobertura.ser file?? > > > > Or maybe it would be useful if this solution was implemented: > > > > During instrumentation the location of created cobertura.ser file is > > somehow stored inside instrumented classes - for example some > > additional method CoverageData.setDataFileLocation is called inside > > static constructor of instrumeted classes. Or maybe some file is > > created among instrumented classes. This way there is no need for > > specifiyng the location of this file during runtime. > > > > I thought about this solution some time ago, but I am not sure it is > > right. Any thoughts? > > > > Grzegorz > > > > > > > > On 6/15/05, Mark Doliner <Mar...@sa...> wrote: > > > 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 > > > > > > > > > > -----Original Message----- > > > > From: cob...@li... > > > > [mailto:cob...@li...] On > > > > Behalf Of bastard metheus > > > > Sent: Wednesday, June 15, 2005 2:14 PM > > > > To: Cob...@li... > > > > Subject: [Cobertura-devel] duplicate copies of > > cobertura.ser file?? > > > > > > > > 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=3D"junit" description=3D"Run All JUnit Tests" > > > > depends=3D"remove-reports"> > > > > > > > > <!-- > > > > <property name=3D"corbertura.file" value=3D"cobertura.ser" /> > > > > --> > > > > <echo level=3D"info">Deleting Corbertura SER > > > > file=3D"${corbertura.file}</echo> > > > > <delete file=3D"${corbertura.file}"/> > > > > <echo level=3D"info">Deleting Instruments > > > > dir=3D"${dir.instruments}"</echo> > > > > <delete dir=3D"${dir.instruments}" /> > > > > > > > > <echo level=3D"info">Making Instruments > > > > Dir=3D"${dir.instruments}"</echo> > > > > <mkdir dir=3D"${dir.instruments}"/> > > > > > > > > <echo level=3D"info">Creating Instruments: > > > > datafile=3D"${corbertura.file}" > > > > todir=3D"${dir.instruments}" > > > > </echo> > > > > > > > > <cobertura-instrument datafile=3D"../../${corbertura.file}" > > > > todir=3D"${dir.instruments}"> > > > > <fileset dir=3D"${dir.classes}"> > > > > <!-- > > > > Instrument all the application > > > > classes, but > > > > don't instrument the test classes. > > > > --> > > > > <include name=3D"**/*.class" /> > > > > <exclude name=3D"**/*Test.class" /> > > > > </fileset> > > > > </cobertura-instrument> > > > > > > > > <echo level=3D"info">Running JUnit ${dir.test.classes}</echo= > > > > > <junit printsummary=3D"yes" haltonerror=3D"${haltonerror}" > > > > 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"/> > > > > > > > > <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> > > > > > > > > <echo level=3D"info">Making > > > > dir=3D"${dir.reports.artifacts}/cobertura"</echo> > > > > <mkdir dir=3D"${dir.reports.artifacts}/cobertura"/> > > > > <cobertura-report format=3D"html" > > > > datafile=3D"../../${corbertura.file}" > > > > srcdir=3D"${dir.src}" > > > > destdir=3D"${dir.reports.artifacts}/cobertura"/> > > > > > > > > <move file=3D"../../cobertura.ser" > > > > todir=3D"bin/test/reports/artifacts/cobertura"/> > > > > > > > > <antcall target=3D"archive"/> > > > > </target> > > > > > > > > > ------------------------------------------------------- > > > SF.Net email is sponsored by: Discover Easy Linux Migration > > Strategies > > > from IBM. Find simple to follow Roadmaps, straightforward articles, > > > informative Webcasts and more! Get everything you need to get up to > > > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&opclick > > > _______________________________________________ > > > Cobertura-devel mailing list > > > Cob...@li... > > > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > > > > > > > ------------------------------------------------------- > > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > > from IBM. Find simple to follow Roadmaps, straightforward articles, > > informative Webcasts and more! Get everything you need to get up to > > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick > > _______________________________________________ > > Cobertura-devel mailing list > > Cob...@li... > > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > |