what is cyclomatic complexity? plz explain with example
Answer Posted / dheemanth kumar
Cyclomatic complexity is a software metric (measurement).
It was 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.
M = E − N + 2P
where
M = cyclomatic complexity
E = the number of edges of the graph
N = the number of nodes of the graph
P = the number of connected components.
"M" is alternatively defined to be one larger than the
number of decision points (if/case-statements, while-
statements, etc) in a module (function, procedure, chart
node, etc.), or more generally a system.
Separate subroutines are treated as being independent,
disconnected components of the program's control flow graph.
[edit] Alternative definition
v(G) = e − n + p
G is a program's flowgraph
e is the number of edges (arcs) in the flowgraph
n is the number of nodes in the flowgraph
p is the number of connected components
[edit] Alternative way
There is another simple way to determine the cyclomatic
number. This is done by 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.
Is This Answer Correct ? | 19 Yes | 16 No |
Post New Answer View All Answers
Explain accessibility testing and its importance in the present scenario.
How to integrate Bugzilla with QTP?
how will we change the server system time?
Manual and automation how do they help in bringing out quality product? Explain?
How to test an Scheduled event? For ex: in an investment banking application, the scheduler will create an equity anbd user has nothing to do but tester has to test if the instrument is created properly or not?
How can a LOG for testcases be maitained which can give information about a TestCase that is it new one or has been occured in previous versions of the software.
Which model is following in your company for developing software?
What is white box testing?
There are some features to improve the performance of a Product. What are those factors?
1.What is configuration Management? 2. Explain Impact Analysis 3. Explain Peer Review 4. what i kickoff phase of Formal Review. 5. Whatv are the phases of fundamental test process. 6. what is state transition testing. 7. what is LCSAJ 8. Test conditions are derived from where?
What's the relationship between environment reality and test phases?
What is defect removable efficiency?
Explain the components of a test plan?
What are the various techniques in black box testing?
Explain the defect life cycle.