0% found this document useful (0 votes)
50 views2 pages

Software Testing - Cyclomatic Complexity

Cyclomatic COMPLEXITY is a source code complexity measurement that is being correlated to a number of coding errors. It is calculated by developing a control flow graph of the code that measures the number of linearly-independent paths throug h a prog ram module. Lower the prog ram's cyclomatic complexity, lower the risk of modifiying and easier to understand.

Uploaded by

KishanMirani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views2 pages

Software Testing - Cyclomatic Complexity

Cyclomatic COMPLEXITY is a source code complexity measurement that is being correlated to a number of coding errors. It is calculated by developing a control flow graph of the code that measures the number of linearly-independent paths throug h a prog ram module. Lower the prog ram's cyclomatic complexity, lower the risk of modifiying and easier to understand.

Uploaded by

KishanMirani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SOFTWARE TESTING - CYCLOMATIC

COMPLEXITY
http://www.tuto rialspo int.co m/so ftware _te sting _dictio nary/cyclo matic_co mple xity.htm
Co pyrig ht tuto rials po int.co m

What is Cyclomatic Complexity?


Cyclomatic complexity is a source code complexity measurement that is being correlated
to a number of coding errors. It is calculated by developing a Control Flow Graph of the
code that measures the number of linearly-independent paths throug h a prog ram module.
Lower the Prog ram's cyclomatic complexity, lower the risk to modify and easier to
understand. It can be represented using the below formula:
Cyclomatic complexity
where,
E = number of edges
N = number of nodes
P = number of nodes

Example :
IF A = 10 THEN
IF B > C THEN
A = B
ELSE
A = C
ENDIF
ENDIF
Print A
Print B
Print C

FlowGraph:

= E - N + P
in the flow graph.
in the flow graph.
that have exit points

T he Cyclomatic complexity is calculated using the above control flow diag ram that shows
seven nodes(shapes) and eig ht edg es (lines), hence the cyclomatic complexity is 8 - 7 + 2
=3

You might also like