From: Czechowski, I. <Igo...@sa...> - 2005-06-23 19:05:57
|
The reason I'm asking is that I think that in certain cases I get faulty reports regarding branch coverage. Any help would be appreciated. A simple example would solve my problem: 1: public void branchCoverage(boolean test) { 2: if (test){ 3: return true; 4: else 5: return false; 6: } When can I achieve 100% branch coverage ?=20 1) When lines 2,4,5 are executed 2) When lines 2,3,4,5 are executed Thanks Igor -----Original Message----- From: cob...@li... [mailto:cob...@li...] On Behalf Of Czechowski, Igor Sent: Wednesday, June 22, 2005 3:23 PM To: Cobertura-devel Subject: [Cobertura-devel] Branch coverage question ? Hi, Where can I find detailed description of branch coverage that cobertura measures ? Thanks Igor ------------------------------------------------------- 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 |
From: Scott S. <sco...@gm...> - 2005-06-23 19:34:01
|
Hi, I don't know the answer on the Cobertura internals, but I would point out two things: 1. Your example's return type is void, but I'd assume you meant it to be boolean. 2. The compiler might optimize or reorganize such a simple method into this= : public boolean branchCoverage(boolean b) { return b; } Scott Stirling On 6/23/05, Czechowski, Igor <Igo...@sa...> wrote: > The reason I'm asking is that I think that in certain cases I get faulty > reports regarding branch coverage. > Any help would be appreciated. >=20 > A simple example would solve my problem: >=20 > 1: public void branchCoverage(boolean test) { > 2: if (test){ > 3: return true; > 4: else > 5: return false; > 6: } >=20 >=20 > When can I achieve 100% branch coverage ? > 1) When lines 2,4,5 are executed > 2) When lines 2,3,4,5 are executed >=20 > Thanks > Igor >=20 >=20 >=20 > -----Original Message----- > From: cob...@li... > [mailto:cob...@li...] On Behalf Of > Czechowski, Igor > Sent: Wednesday, June 22, 2005 3:23 PM > To: Cobertura-devel > Subject: [Cobertura-devel] Branch coverage question ? >=20 > Hi, >=20 > Where can I find detailed description of branch coverage that cobertura > measures ? >=20 > Thanks > Igor >=20 >=20 > ------------------------------------------------------- > 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 >=20 >=20 > ------------------------------------------------------- > 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 > |
From: Grzegorz L. <ha...@gm...> - 2005-07-03 14:28:20
|
As Igor pointed, Cobertura computes Branch Coverage rather strange. Check class net.sourceforge.cobertura.reporting.Main in sample report on main Cobertura site. There is 100% Branch Coverage and 65% Line Coverage. You can find also comment in source for net.sourceforge.cobertura.instrument.MethodInstrumenter: * TODO: For branches, only count the branch as covered if both paths are accessed? Now it marks that branch was executed when "branch point" is executed. Grzegorz On 6/23/05, Scott Stirling <sco...@gm...> wrote: > Hi, >=20 > I don't know the answer on the Cobertura internals, but I would point > out two things: >=20 > 1. Your example's return type is void, but I'd assume you meant it to > be boolean. >=20 > 2. The compiler might optimize or reorganize such a simple method into th= is: >=20 > public boolean branchCoverage(boolean b) { > return b; > } >=20 > Scott Stirling >=20 > On 6/23/05, Czechowski, Igor <Igo...@sa...> wrote: > > The reason I'm asking is that I think that in certain cases I get fault= y > > reports regarding branch coverage. > > Any help would be appreciated. > > > > A simple example would solve my problem: > > > > 1: public void branchCoverage(boolean test) { > > 2: if (test){ > > 3: return true; > > 4: else > > 5: return false; > > 6: } > > > > > > When can I achieve 100% branch coverage ? > > 1) When lines 2,4,5 are executed > > 2) When lines 2,3,4,5 are executed > > > > Thanks > > Igor > > > > > > > > -----Original Message----- > > From: cob...@li... > > [mailto:cob...@li...] On Behalf Of > > Czechowski, Igor > > Sent: Wednesday, June 22, 2005 3:23 PM > > To: Cobertura-devel > > Subject: [Cobertura-devel] Branch coverage question ? > > > > Hi, > > > > Where can I find detailed description of branch coverage that cobertura > > measures ? > > > > Thanks > > Igor > > > > > > ------------------------------------------------------- > > 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 > > > > > > ------------------------------------------------------- > > 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 > > >=20 >=20 > ------------------------------------------------------- > 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 > |