Thanks:  0
Likes:  0
Dislikes:  0

1. ## Cyclomatic complexity

Hi everyone,
Have anyone calculated cyclomatic complexity during white box testing?
I know the calculation part of it but im yet to be sure of the real usage of it.
As far as i know,it is just used to calculate the number of independent paths,
What do we actually achieve by calculating the cyclomatic complexity?
Is it really a necessary part of white box testing?
Can someone help me on this?

------------------
Regards,
Balaji

2. ## Re: Cyclomatic complexity

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by sbalajis76:
What do we actually achieve by calculating the cyclomatic complexity?
Is it really a necessary part of white box testing?
<HR></BLOCKQUOTE>

It is not a "necessary" part in the strictly logical sense that if you do not do this, your code will surely fail. As it is, the measure of cyclomatic complexity is just that: a measure. How good or bad it is depends on how you derive it what you read into it or from it.

As you state, this is a measure of the number of independent paths in a program, thereby ostensibly placing a numerical value on the complexity. (Perhaps you see a danger with that assumption. It is a danger. More on that in a moment.) In actual practice, cyclomatic complexity can be a guide to the count of the number of test conditions in a program, which can be helpful. In other words, you have test conditions at a code level that can be used to guide test case creation or to act as check on test cases.

As far as advantages to this, is that it can be used as an "ease of maintenance" type of metric. In other words, the idea is that the more logical branching you have, the higher the complexity and thus the more that maintenance or updating could be troublesome. (This also depends on the amount of nesting.) It can help guide to areas where you might want to focus more testing. (Side note: if you do hidden-fault analysis the results of something like cyclomatic complexity can be helpful as a guide to those areas that are more likely to have "hidden faults".)

As far as drawbacks to this approach go, I would maintain that it is not always a true measure of control complexity. It may be better than nothing, but one should still be cautious. Beyond that keep in mind that while it measures complexity, it does so entirely in terms of control flow. It speaks nothing at all to data complexity (and when you get into data integrity testing, that is part of what you have to consider). Also note that above I mentioned nesting, but cyclomatic complexity seems to place the same weights on nested and non-nested flow structures. When data flow is involved, this measure can be very misleading in terms of various decision structures that data must flow through, particularly if those decision structures cause manipulation of the data.

Does some of that help?

------------------

3. ## Re: Cyclomatic complexity

Thanks a lot,.
I now understand the real usage of the cyclomatic complexity and it is not really necessary for a tester to calculate the cyclomatic complexity to do a full fledged testing,
it just helps a tester.
Thanks for the information provided by you.

------------------
Regards,
Balaji

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.