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
after completeing testing ,what would u deliver to the client?
what is the critical defect in telecom domain?help me out from this prob its very urgent
What is date driven testing?
Hi, this is murthysharma. I need very urgently about some terms which are used in use cases? Plz give reply to me, if any body know, It is really very very urgent. 1. what is the difference between basic flow,exception flow and alternative flow? 2.what are non-functional requirements in use cases? 3.what are exceptions, special requirements, business rules, assumptions, constraints. Kindly give me with the example. Bcoz, I am very new to this use cases. thanks in Advance. Regards, M.MurthySharma
what is the impact analysis?
send the senario template
What is bidirectional traceability ??? and how it is implemented
What is ecp (equivalence class partition)?
If date field is a text field write test cases to validate it?
what are the risk factors in the project? what is the base for testplan and entry criteria ,exit criteria for test plan?
Can you explain exploratory testing?
What type of projects can include in Logistics Domain? and what is the type of domain for project which include Driving license renewal, Different type of title registration etc...
What is the difference between web based application and client server application?
Q) Create Preffered customer: As a customer when i purchase more than $5000 in goods since my first purchase, I become a preffered customer so that i can receive the benefits associated with that status.
Architectural structure of the insurance project?