2

I am trying to understand the cyclomatic complexity concept and came across in web that the cyclomatic complexity for below code (pseudo) is 3, but I thought, as there are 4 possible test scenarios, cyclomatic complexity has to be 4

If (Condition 1)
Statement 1

Else
Statement 2

If (Condition 2)
Statement 3

Else
Statement 4

Could you please help me understand.

Thanks

4 possible test scenarios are:

  1. condition1 = true, condition2 = true;
  2. condition1 = true, condition2 = false;
  3. condition1 = false, condition2 = true;
  4. condition1 = false, condition2 = false;
byxor
  • 5,930
  • 4
  • 27
  • 44
Jay
  • 21
  • 2

1 Answers1

0

I think you confused between path coverage and cyclomatic complexity

cyclomatic complexity <= number of paths

explaintion from wikipedia

https://en.wikipedia.org/wiki/Cyclomatic_complexity