what is cyclomatic complexity? plz explain with example
Answer Posted / deep singh kushwaha
Cyclomatic complexity is a software metric (measurement) developed by Thomas McCabe and is used to measure the complexity of a program. It directly measures the number of linearly independent paths through a program's source code.
One of the ways is counting the number of closed loops in the flow graph, and incrementing the number by one.
i.e.
M = Number of closed loops + 1
where
M = Cyclomatic number.
Implications for Software Testing
M is a lower bound for the number of possible paths through the control flow graph.
M is an upper bound for the number of test cases that are necessary to achieve a complete branch coverage.
For example, consider a program that consists of two sequential if-then-else statements.
if (c1) {
f1();
} else {
f2();
}
if (c2) {
f3();
} else {
f4();
}
To achieve a complete branch coverage, two test cases are sufficient here.
For a complete path coverage, four test cases are necessary.
The cyclomatic number M is three, falling in the range between these two values, as it does for any program.
please suggest me if i m wrong..
e-mail-deepsingh.154@gmail.com
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can any1 tell me suppose u r doing manual testing on unix platform with Shell Script, then how it is done? How u r implementing it & what is the use of Shell scripting on Manual Testing?
Do we have any certifications for ETL Testing ?
Why Equivalence Partitioning is called equivalence or what is the significance of equivalence term in ECP?
what r u r responsibilities in current project
plz tell me the difference b/w PB/MF based appl.with examples. Thanks
What is unit level testing?
how is market for testing in banglore,chennai,pune,delhi?
Which criteria should take in account while doing CMS testing of any project?
why use caffine for HPLC calibration ?
What type of testing you perform in organization while you do system testing, give clearly?
what type of quetion may be asked for experienced person in manual tester of 1 year?
HI. ANYONE HAS ATTENDED INTERVIEW FOR TESTING IN MINDKRAFT GLOBAL. I HAVE WRITTEN TEST FOR SOFTWARE TESTING. CAN ANYONE TELL ME WHAT ALL QUESTIONS CANBE ASKED. PLS REPLY. THANK YOU
Explain thread testing.
How we allocate the priority(Blocker, Critical, etc.,) in Testing?
Hi,all i have a desktop App. which have a feature, It's a demo version if u want full version then u have to perches it. Pls give me some idea ASAP how can i break the App.