Daklu Posted August 2, 2009 Report Share Posted August 2, 2009 (edited) I was reading through one of NI's documents where they discussed code coverage. Here's a diagram from the article: How in the world does someone look at that and claim they have 50% code coverage? I look at that and see that at best you've got 40% coverage. 16% if you're measuring execution paths instead of executed code. What gives? Edited August 2, 2009 by Daklu Quote Link to comment
Aristos Queue Posted August 2, 2009 Report Share Posted August 2, 2009 I don't understand the math entirely either, but I'm confident it is correct if only because two math nerds explained it to me twice. I actually understood it for a brief moment after the second explanation, but then I forgot. 1 Quote Link to comment
unicorn Posted August 3, 2009 Report Share Posted August 3, 2009 I think the figure ist just an illustration of the outcome of a specific test. So I guess it is not self-explaining. But if you imagine that only 50% of posible data paths in the code is tested and the code coverage will be multiplicative thru the hierarchy you will easily see that you need lots of test vectors to get a sufficient high code coverage for the overall code. Quote Link to comment
crelf Posted August 3, 2009 Report Share Posted August 3, 2009 ...16% if you're measuring execution paths instead of executed code. "Code Coverage" is a a relative term and it doesn't really mean execution paths (that's cyclomatic complexity, which is very difficult to conceptualize with any programming language, and LabVIEW in particular). More info here (at arond the 15 minute mark). OK - the image is a little difficult to follow because it doesn't show that what we're actually counting here are diagrams - each of the executed pages is a diagram, and the main BD is counted a diagram, so that adds up to 3 diagrams executed. There are a total of 6 diagrams (the main BD, 2 cases in the first structure and 3 in the second), so that's a total of 3/6 = 50%. It is *not* tracing paths at the component level - it's tracing them at the diagram level. This all makes sense (it's the same method used by the VISTA Code Coverage Toolkit from oh so many years ago) - if the main BD wasn't counted, then the aggregate matrics for a whole project would be wrong. I just got the skinny from Eli Kerry (one of the benefits of being on the ground at NI-Week 09 ) and he gave me this - I think that the colour coding goes a long way in making it more clear: It's the green diagrams that are counted in this test case. ...and here's the coverage graphic for the 2nd test vector: 2 Quote Link to comment
Daklu Posted August 3, 2009 Author Report Share Posted August 3, 2009 That is much clearer. Thanks for posting Chris! (Eli too!) Quote Link to comment
jgcode Posted August 4, 2009 Report Share Posted August 4, 2009 "Code Coverage" is a a relative term Great job Crelf Quote Link to comment
crelf Posted August 4, 2009 Report Share Posted August 4, 2009 Great job Crelf Anytime Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.