Snehakesarwani Loop Call Path Coverage
Snehakesarwani Loop Call Path Coverage
Title: White Box Testing: Loop Coverage, Call coverage and Path Coverage.
Problem Statement:
0 Euclid(int m, int n){
1 int r;
2 if (n > m){
3 r = m;
4 m = n;
5 n = r;
6 }
7 r = m % n;
8 while( r! = 0){
9 m = n;
10 n = r;
11 r = m % n;
12 }
13 return n;
14 }
Step 2: Flowchart
Step 3: Calculate the cyclomatic complexity
V(G) : Cyclomatic Complexity, E : No of Edges, N: No of Nodes, P : No of connected areas/ no
of methods V(G) = E – N + 2P
= 16 – 15 + 2
=3
V(G) = No of predicates/Conditions + 1
=4
Decision Coverage for over all Code = 4/4 * 100 = 100%
100% decision coverage guarantees 100% statement coverage, but not the other way around!
Conclusion:
The control flow graph is drawn and the cyclomatic complexity is determined to be 3. Three
basis paths are to be tested.
Practical no:
Title: White Box Testing: Loop Coverage, Call coverage and Path Coverage.
Problem Statement:
Step 1: Number the line of code
Step 2: Flowchart
Step 3: Calculate the cyclomatic complexity
V(G) = E – N + 2=4
= 23 = 8
Decision Coverage for over all Code = 6/8 * 100 = 75%
100% decision coverage guarantees 100% statement coverage, but not the other way around!
Conclusion:
The control flow graph is drawn and the cyclomatic complexity is determined to be __4___.
_Three___ basis paths are to be tested.