Professional Documents
Culture Documents
Objective of the Tutorial: To draw a Flow Graph, a DD Graph, calculation of Cyclomatic Complexity V(G)
and find out all independent paths from the DD paths graph, for the case of a triangle wherein the program
reads the three sides of a triangle (say a, b, c). The output may be Scalene triangle or a Isosceles triangle or
an equilateral triangle or might not be a triangle at all.
When we have a flow graph, we can easily draw another graph that is known as decision-to-decision or (DD)
path graph, wherein we lay our main focus on the decision nodes only. The nodes of the flow graph are
combined into a single node it they are in sequence.
Process of constructing the DD Graph leading to computation of Cyclomatic Complexity goes like
this:
# include <stdio.h>
# include <conio.h>
(2) {
(10) if ((a > 0) && (a < - 100) && (b > 0) && (b < . 100) && (c > 0) && (c < =100)) {
(11) if ((a + b) > c) && ((c + a) > b) && ((b + c) > a)) {
(12) boolean = 1;
(13) }
(14) }
(15) else {
(16) boolean = -1;
(17) }
(18) if (boolean = = 1) {
(21) }
(24) }
(25) else {
(27) }
(28) }
(31) }
(32) else
(34) }
(35) getch ( );
(37) }
Since, nodes 1-9 are sequential nodes in the above flow graph, hence they are merged together as a single node – “a”.
Likewise we can go on deciding the merging of nodes & arrive at the following DD Path Graph
We get following decision table.
Method – 1: V(G) = e – n + 2 ( Where “e” are edges & “n” are nodes)
Conclusion – 1: Each of these paths consists of at least one new edge. Hence this basis set of paths
is NOT unique.
Conclusion – 2: Test cases should be designed for the independent path execution as identified
above.
Conclusion – 3: We must execute these paths at least once in order to test the program thoroughly.
Please Click here to read many more Articles & Tutorials on White Box Testing