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
Hi Everybody could you please send me the ISTQB Material to my mail id karthik18487@gmail.com Thanking you in advance
how to test ecg machine?
What is quality center? What are the modules of quality center?
Why documentation testing is important?
I have cleared written test and one Technical round in one company? now i have to face an Client Round through telephony? Any body have faced client round, how will it be , wil they ask technical or is it only formality round? im nervous, plz let me know wat all they may ask? i have this round on monday?
how will the test plan is pepared in ur organisation>?
send the senario template
Explain Testing process in your organization?
How we allocate the priority(Blocker, Critical, etc.,) in Testing?
Why would we not include these?
What is bidirectional traceability ??? and how it is implemented
how to connect your project in database?
What is test out put?
iwant know IEEE formate ,how it is used and exactly where it is used? i have details it follows test plan, testcases...etc. i want real time explanation. pls any one give?
What is defect validity ratio?