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
what are the possible test cases for online jobs search portal..if its a job seeker module and any 1 if u had worked on this proj pls share the bugs with sev and priority pls frends i need replies for these queries ..thanks in advance
What is verification in software testing?
discuss black box and white box testing is not widely used if you disagree tell me why?
What are the main key components in Web applications and Client Server applications? and their differences?
do we need to write test cases for workflow of the product for instance: there is 2 module "TRAINING ASSIGN MODULE" and "EMPLOYEE" in TRAINING assign MODULE iam assigning training to employee setp is 1.selct traning "oracle" 2.select employee u want assign "peter" 3.apply. now to check whether training assign or not GOTO EMPLOYEE module 1.click on "peter" 2.click on 'view assign to employee'link.now this is a flow do i need to write test cases for this fllow.plz help me guy mail me nirmal_rawatt@rediff.com
What is bottom-up approach?
HI, This question is Investment Banking domain related Question. I was asked in an Interview to tell the 5 test cases for Equity,Bond,Futures and options. Please help.. Pragya
what is a horizontal and vertical matrix explain with examples
What are the bugs we cannot find in black box?
What is reverse engineering?
During alpha testing why customer people are invited?
How will you determine when to stop testing?
what do you mean by Develop test data through sourcing (or) handcrafting techniques
Explain branch coverage and decision coverage.
whta is compile module?