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:
- condition1 = true, condition2 = true;
- condition1 = true, condition2 = false;
- condition1 = false, condition2 = true;
- condition1 = false, condition2 = false;