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
how will you test a wine filled bottle along with 100 glasses
what is difference between win 98 and win 2000 poertating system?which is better one?
whta is compile module?
Test cases for Internal IP Messenger
How to do integration testing on duster......
what is your daily activities?
I have an UI issue "please fill out this field" pop up in firefox browser keeps scrolling with the page is it valid???
Assume a login page, and you have written 10 cases(say for example). How will you justify that these 10 testcase suffient for the login and how do you say this is 100% satisfies the need.
Can you explain requirement traceability and its importance?
Katari your questions was really helpful could you please send the questions and answers with them . Can anyone sends the top 30-40 question and answers for the interview purposes
What is a critical bug?
in transfer funds module, how you come to know that amount has been transferred successfully or not....explain in detail
Hi Can any one tell wht type of questions will be asked in project manager round...urgent plz...
What r the things,u prefer and prepare before starting testing?
Can you explain the various elements of function points ftr, ilf, eif, ei, eo, eq, and gsc?