From: <Ala...@ba...> - 2005-05-18 10:11:06
|
Yep, that worked. thanks -----Original Message----- From: Mark Doliner [mailto:Mar...@sa...]=20 Sent: 17 May 2005 20:36 To: Mcinnes, Alan: IT (LDN) Cc: cob...@li... Subject: RE: [Cobertura-devel] All my packages have zero coverage A few things: * You can do a search on your computer for files named "cobertura.ser" This file is created when you instrument your classes, and it's SUPPOSED to be updated by your classes when your tests are run. However, depending on which directory your tests are run from, your classes may instead just create a second cobertura.ser file. If you have 2 of these files in different directories, then this is likely the root of your "0%" coverage. * I'm not sure I quite trust the "merge" task... That code is largely unchanged from the jcoverage days, and other parts of Cobertura have had fairly major changes. It is in need of a good overhaul. And looking at your output, it DOES look like you have multiple ser files: "[junit] - java.io.FileNotFoundException: C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\build\cobertur a.ser (The system cannot find the file specified)" For now I think the best thing to do is to move your cobertura.ser before and after you run your tests. You'll want to move the file to wherever your test classes expect to find this file. Yes, I know this is a bit ugly. Hopefully this will all be much easier to deal with in Cobertura 1.3 (mostly due to clearer documentation). -Mark > -----Original Message----- > From: cob...@li... > [mailto:cob...@li...] On=20 > Behalf Of Ala...@ba... > Sent: Wednesday, May 11, 2005 11:26 AM > To: cob...@li... > Subject: [Cobertura-devel] All my packages have zero coverage >=20 > Hi guys - just downloaded the app yesterday and it looks > great. Trouble > is all my packages have 0% coverage (bar 2 which have 100). I know we > havent got a lot of tests yet, but we have more than that ;-) >=20 > Anyway, I have a couple of thousand files. I use ant so I'm not sure=20 > how to pass in the cobertura.ser file property as suggested in the=20 > faq, but I tried cobertura-merge and this didn't seem to make much > difference. All the files and instrumented code etc seem to get > generated ok, and the classpath references the instrumented code >=20 > Ive attached my ant script and a snipped version of the output after=20 > running it. >=20 > Any suggestions greatfully received >=20 > Thanks > Alan >=20 > ANT: > <property name=3D"cobertura" value=3D"${lib}/cobertura.jar" /> > <property name=3D"instrumented-classes"=20 > value=3D"${basedir}/instrumented-classes" /> > <property name=3D"coverage-report-dir" value=3D"${basedir}/cover-rep" /> > <taskdef classpath=3D"${cobertura}" resource=3D"tasks.properties" /> > <path id=3D"coverage.classpath"> > <pathelement > location=3D"${instrumented-classes}"/> > <pathelement location=3D"${config}"/> > <path refid=3D"jdk.path"/> > <fileset refid=3D"external.jars"/> > <pathelement location=3D"${cobertura}" /> > </path> > <target name=3D"test-coverage" depends=3D"compile-test" > > <delete quiet=3D"false" failonerror=3D"false" > includeemptydirs=3D"true"> > <fileset dir=3D"${instrumented-classes}" /> > <fileset dir=3D"${junit.results}" /> > <fileset dir=3D"${coverage-report-dir}" /> > <fileset dir=3D"${basedir}"> > <include name=3D"**/cobertura.ser" /> > </fileset> > </delete> > <cobertura-instrument todir=3D"${instrumented-classes}"> > <fileset dir=3D"${dest}"> > <include name=3D"**/*.class"/> > </fileset> > </cobertura-instrument> > <mkdir dir=3D"${junit.results}"/> > <junit fork=3D"yes" haltonfailure=3D"yes" > printsummary=3D"on"> > <classpath > refid=3D"coverage.classpath"/> > <formatter type=3D"brief" > usefile=3D"false"/> > <formatter type=3D"xml"/> > <batchtest > todir=3D"${junit.results}"> > <!-- exclude Robert's > tipctest package from unit tests --> > <fileset > dir=3D"${instrumented-classes}" includes=3D"**/${tests}.class" > excludes=3D"**/tipctest/*.class"/> > </batchtest> > </junit> > <cobertura-merge> > <fileset dir=3D"${basedir}"> > <include name=3D"**/cobertura.ser"/> > </fileset> > </cobertura-merge> > <cobertura-report srcdir=3D"${src}" > destdir=3D"${coverage-report-dir}"/> > </target> >=20 > OUTPUT: > Buildfile:=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d\build.xm > l > init: > generate: > [echo] Generating stubs from WSDL > compile: > [javac] Compiling 56 source files to=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\classes > compile-test: > test-coverage: > [delete] Deleting 1827 files from=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\inst > rumented-c > lasses > [delete] Deleted 206 directories from=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\inst > rumented-c > lasses > [delete] Deleting 71 files from=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\test-results > [delete] Deleted 1 directory from=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\test-results > [delete] Deleting 1776 files from=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\cover-rep > [delete] Deleted 4 directories from=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\cover-rep > [delete] Deleting 2 files from=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server > [cobertura-instrument] Cobertura 1.2 > [cobertura-instrument] Copyright (C) 2003 jcoverage ltd.=20 > [cobertura-instrument] Copyright (C) 2005 Mark Doliner=20 > <the...@us...> > [cobertura-instrument] Cobertura is licensed under the GNU General=20 > Public License [cobertura-instrument] Cobertura comes with ABSOLUTELY=20 > NO WARRANTY [cobertura-instrument] instrumenting 2116 classes to > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\inst > rumented-c > lasses > [cobertura-instrument] Instrument time: 53920ms > [mkdir] Created dir: > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\test-results > [junit] Running com.barcap.credit.cdt.CDTExampleTest > [junit] - loading: > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d/cobertur > a.ser > [junit] - java.io.FileNotFoundException: > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d\cobertur > a.ser (The system cannot find the file specified) > [junit] - loaded: 0 items. > [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.469 > sec > [junit] Testsuite: com.barcap.credit.cdt.CDTExampleTest > [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.469 > sec > [junit] - shutdown hook started > [junit] - saving: > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d/cobertur > a.ser > [junit] - saved 1 entries. > [junit] - saved: 1 items. > [junit] - shutdown hook has finished > [junit] Running > com.barcap.credit.cdt.domain.client.ClientManagerServiceTest > [junit] - loading: > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d/cobertur > a.ser > [junit] - loaded 1 entries. > [junit] - loaded: 1 items. > [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 8.375 > sec > [junit] Testsuite: > com.barcap.credit.cdt.domain.client.ClientManagerServiceTest > [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 8.375 > sec > [junit] ------------- Standard Output --------------- > [junit] ------------- ---------------- --------------- > [junit] - shutdown hook started > [junit] - saving: > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d/cobertur > a.ser > [junit] - saved 331 entries. > [junit] - saved: 331 items. > [junit] - shutdown hook has finished > [junit] Running > com.barcap.credit.cdt.domain.counterparty.CounterpartyManagerS > erviceTest > [junit] - loading: > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d/cobertur > a.ser > [junit] - loaded 331 entries. > [junit] - loaded: 331 items. >=20 > <snip> > lots of junit output similar to that above & below > </snip> >=20 > [junit] Running com.barcap.credit.cdt.util.xml.SimpleExtractorTest > [junit] - loading:=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d/cobertur > a.ser > [junit] - loaded 850 entries. > [junit] - loaded: 850 items. > [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 0.438 > sec > [junit] - shutdown hook started > [junit] - saving:=20 > C:\ClearCase\mcinnesa_credit-dev\fo_CDT_Credit\CDT\Server\buil > d/cobertur > a.ser > [junit] - saved 851 entries. > [junit] - saved: 851 items. > [junit] - shutdown hook has finished > [cobertura-merge] Cobertura 1.2 > [cobertura-merge] Copyright (C) 2003 jcoverage ltd. [cobertura-merge]=20 > Copyright (C) 2005 Mark Doliner <the...@us...> > [cobertura-merge] Cobertura is licensed under the GNU General Public > License > [cobertura-merge] Cobertura comes with ABSOLUTELY NO WARRANTY > [cobertura-merge] Cobertura instrumentation merge tool > [cobertura-merge] cobertura loading: cobertura.ser > [cobertura-merge] cobertura loading: build\cobertura.ser > [cobertura-report] Cobertura 1.2 > [cobertura-report] Copyright (C) 2003 jcoverage ltd. > [cobertura-report] Copyright (C) 2005 Mark Doliner > <the...@us...> > [cobertura-report] Cobertura is licensed under the GNU General Public > License > [cobertura-report] Cobertura comes with ABSOLUTELY NO WARRANTY >=20 >=20 > -------------------------------------------------------------- > ---------- > For more information about Barclays Capital, please > visit our web site at http://www.barcap.com. >=20 >=20 > Internet communications are not secure and therefore the Barclays > Group does not accept legal responsibility for the contents of this=20 > message. Although the Barclays Group operates anti-virus programmes,=20 > it does not accept responsibility for any damage whatsoever that is=20 > caused by viruses being passed. Any views or opinions presented are=20 > solely those of the author and do not necessarily represent=20 > those of the=20 > Barclays Group. Replies to this email may be monitored by=20 > the Barclays=20 > Group for operational or business reasons. >=20 > -------------------------------------------------------------- > ---------- >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be=20 > the first software developer in space? Enter now for the Oracle Space=20 > Sweepstakes! http://ads.osdn.com/?ad_ids93&alloc_id=16281&op=3Dick > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel >=20 |