From: SourceForge.net <no...@so...> - 2012-03-23 11:07:17
|
Bugs item #2075537, was opened at 2008-08-26 03:13 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=720015&aid=2075537&group_id=130558 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Accepted Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Branch coverage for switch statement fall-through cases Initial Comment: I'm currently using Cobertura 1.9, and I think it may be miscalculating branch coverage for a switch statement; cases which fall-through to the following case do not seem to be recognised as covered. I've got the following code: public enum AnEnumeration { FOO, BAR, GONK }; public boolean someMethod(AnEnumeration e) { switch (e) { case FOO: case BAR: case GONK: return true; default: return false; } } The unit-test is checking all of the values in the enumeration but not the default case, so I'd expect to see branch coverage of 75% (3 out of 4 branches covered). However, the HTML coverage report seems to indicate that the branches aren't covered at all -- the calculated branch coverage is 25% (1/4). Interestingly, I've tried changing the switch statement to remove the fall-through behaviour: public boolean someMethod(AnEnumeration e) { switch (e) { case FOO: return true; case BAR: return true; case GONK: return true; default: return false; } } With the above code and the same unit-test, Cobertura indicates that the branches are covered and gives the expected coverage figure of 75% (3/4). So, to my uneducated eye, this looks like the fall-through behaviour is somehow confusing the branch coverage calculation. In case it matters, I'm using Java 5. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-23 04:07 Message: Really enjoyed this article.Really looking forward to read more. Want more. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-23 03:52 Message: wow, awesome blog article.Really thank you! Awesome. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-23 02:51 Message: Major thanks for the blog.Really looking forward to read more. Cool. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-23 01:36 Message: Really enjoyed this blog post. Fantastic. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-23 00:22 Message: Wow, great article post.Really thank you! Cool. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 23:09 Message: Thanks so much for the article.Really looking forward to read more. Really Cool. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 21:53 Message: Im obliged for the post.Thanks Again. Fantastic. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 20:27 Message: I cannot thank you enough for the blog. Really Cool. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 19:12 Message: Im grateful for the article post.Really looking forward to read more. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 17:49 Message: Looking forward to reading more. Great article post.Really thank you! Want more. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 16:31 Message: Great article.Really thank you! Will read on... ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 15:30 Message: Looking forward to reading more. Great article post.Really thank you! Really Cool. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 15:30 Message: I really liked your blog post.Thanks Again. Great. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 14:25 Message: Fantastic blog article.Much thanks again. Will read on... ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 14:18 Message: Very neat blog article. Cool. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 13:44 Message: Enjoyed every bit of your post.Really thank you! Keep writing. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 13:28 Message: Thanks for sharing, this is a fantastic blog.Thanks Again. Want more. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 13:23 Message: Major thankies for the post.Really thank you! Great. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 12:34 Message: Im obliged for the blog post.Really looking forward to read more. Keep writing. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 11:41 Message: Enjoyed every bit of your post. Awesome. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 10:54 Message: Im thankful for the article post.Much thanks again. Really Cool. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 10:08 Message: I think this is a real great article.Thanks Again. Awesome. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 09:23 Message: Enjoyed every bit of your article post.Thanks Again. Fantastic. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 08:26 Message: I really like and appreciate your article post.Really thank you! ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2012-03-22 04:58 Message: IZSjoq Thank you ever so for you blog.Really thank you! Really Great. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2011-12-18 01:35 Message: Fw9lSf <a href="http://rxlkpmkvtczd.com/">rxlkpmkvtczd</a>, [url=http://nkopbwehahjq.com/]nkopbwehahjq[/url], [link=http://tggkiatvrjbu.com/]tggkiatvrjbu[/link], http://lxsbuahjnagm.com/ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2011-11-13 10:13 Message: 8zCY3x <a href="http://vnhwwjukjurt.com/">vnhwwjukjurt</a>, [url=http://jyypnkvzyiov.com/]jyypnkvzyiov[/url], [link=http://jnrlpgolchpp.com/]jnrlpgolchpp[/link], http://loqsmdcgixxp.com/ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2011-11-13 10:13 Message: 8zCY3x <a href="http://vnhwwjukjurt.com/">vnhwwjukjurt</a>, [url=http://jyypnkvzyiov.com/]jyypnkvzyiov[/url], [link=http://jnrlpgolchpp.com/]jnrlpgolchpp[/link], http://loqsmdcgixxp.com/ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2011-08-19 09:05 Message: Mp5NE1 <a href="http://xahfoplgeggf.com/">xahfoplgeggf</a>, [url=http://odsjnceaqefk.com/]odsjnceaqefk[/url], [link=http://uqohrpgrvboa.com/]uqohrpgrvboa[/link], http://yxfegmkhijom.com/ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2011-07-30 14:54 Message: PTsAti <a href="http://xdmdgeysfqjw.com/">xdmdgeysfqjw</a>, [url=http://pibenednxjqv.com/]pibenednxjqv[/url], [link=http://tmtspxtbkeaf.com/]tmtspxtbkeaf[/link], http://leidsspxsgxy.com/ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2011-06-30 21:33 Message: niCiHf <a href="http://lngdwqrbhjmp.com/">lngdwqrbhjmp</a>, [url=http://lyrnxnxovhib.com/]lyrnxnxovhib[/url], [link=http://itgctlaxqxqz.com/]itgctlaxqxqz[/link], http://vmtncyfamimc.com/ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2011-05-17 16:51 Message: fL3Xod <a href="http://kgoixptxrrrs.com/">kgoixptxrrrs</a>, [url=http://zhdpsftyufbx.com/]zhdpsftyufbx[/url], [link=http://vinsuxyjwkjf.com/]vinsuxyjwkjf[/link], http://gtblfuvruime.com/ ---------------------------------------------------------------------- Comment By: John Lewis (lewijw) Date: 2011-01-24 15:53 Message: Changes to the way switch statments are reported will probably go in the next release. Please see: http://sourceforge.net/mailarchive/forum.php?thread_name=EC3002866D5A9D4887210D53E3DA563914CB1E64%40MERCMBX03D.na.SAS.com&forum_name=cobertura-devel ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=720015&aid=2075537&group_id=130558 |