What Is Cyclomatic Complexity?

What Is Cyclomatic Complexity?
March 08 07:04 2017  

Metrics plays an important part in the field of software development and software testing. Software metric is a qualitative measure of particular system aspects with regard to the product cost, size and quality.

The notion of cyclomatic complexity is connected with software metric. It defines the program complexity. This parameter was developed by Thomas J. McCabe in 1976. The control flow representation of the program is the basis for this notion. In this case, a program is a graph that includes:

  • Nodes – processing tasks,
  • Edges – control flow between the nodes.

Mathematically, it can be calculated with the help of such a formula – V(G)=E-N+2, where

  • E is a number of edges,
  • N – number of nodes,
  • V(G) – the maximum number of independent paths in the graph.

For the specialists who perform mobile testing, software program testing, web testing and desktop testing, cyclomatic complexity equals the number of test cases. This matric is suitable for white box testing.

What Is the Purpose of Cyclomatic Complexity?

  • It helps to define the independent path executions.
  • It ensures that the test team has run all paths at least once.
  • It provides the possibility to focus on the uncovered paths.
  • It ensures fuller code coverage.
  • It evaluates the risks connected with program or app.
  • It helps to reduce the possible risks.

A set of special tools for defining cyclomatic complexity is available. They are devMetrics, NDepends, GMetrics, OCLint, etc.

Learn more from QATestLab

Related Posts:

About Article Author

view more articles
Nataliia Vasylyna
Nataliia Vasylyna

View More Articles

Related Articles