0% found this document useful (0 votes)
5 views10 pages

White Box Testing

The document discusses white box testing for a triangle classification program, detailing the flow graph and DD Path graph along with independent paths derived from the DD Path graph. It also introduces cyclomatic complexity, providing a formula and an example calculation that results in five independent paths for the flow graph. The independent paths are listed, showcasing various combinations of nodes in the flow graph.

Uploaded by

harishs24082003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views10 pages

White Box Testing

The document discusses white box testing for a triangle classification program, detailing the flow graph and DD Path graph along with independent paths derived from the DD Path graph. It also introduces cyclomatic complexity, providing a formula and an example calculation that results in five independent paths for the flow graph. The independent paths are listed, showcasing various combinations of nodes in the flow graph.

Uploaded by

harishs24082003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

White Box testing

Software Testing

Consider a program given in Fig.8.20 for the classification of a triangle. Its input is a
triple of positive integers (say a,b,c) from the interval [1,100]. The output may be
[Scalene, Isosceles, Equilateral, Not a triangle].
Draw the flow graph & DD Path graph. Also find the independent paths from the DD
Path graph.
Software Testing
Software Testing

Code of triangle classification problem


Software Testing
Solution :

Flow graph of
triangle problem is:

Program flow graph


Software Testing
The mapping table for DD path graph is:
Flow graph DD Path graph Remarks
nodes corresponding
node

1 TO 9 A Sequential nodes

10 B Decision node

11 C Decision node

12, 13 D Sequential nodes

14 E Two edges are joined here

15, 16, 17 F Sequential nodes

18 G Decision nodes plus joining of two edges

19 H Decision node

20, 21 I Sequential nodes

22 J Decision node

23, 24 K Sequential nodes

25, 26, 27 L Sequential nodes

Cont….
Software Testing

Flow graph DD Path graph Remarks


nodes corresponding
node
28 M Three edges are combined here
29 N Decision node
30, 31 O Sequential nodes
32, 33, 34 P Sequential nodes
35 Q Three edges are combined here
36, 37 R Sequential nodes with exit node

DD Path graph
Software Testing
DD Path graph is given in Fig

Independent paths are:


(i) ABFGNPQR
(ii) ABFGNOQR
(iii) ABCEGNPQR
(iv) ABCDEGNOQR
(v) ABFGHIMQR
(vi) ABFGHJKMQR
(vii)ABFGHJMQR

DD Path graph
Software Testing
Cyclomatic Complexity

McCabe’s cyclomatic metric V(G) = e - n + 2P.


For example, a flow graph shown in in Fig. with entry node ‘a’ and exit node ‘f’.

Fig. 21: Flow graph


Software Testing

The value of cyclomatic complexity can be calculated as :


V(G) = 9 - 6 + 2 = 5
Here e = 9, n = 6 and P =1

There will be five independent paths for the flow graph illustrated in Fig..
Path 1 : acf
Path 2 : abef
Path 3 : adcf
Path 4 : a b e a c f or a b e a b e f
Path 5 : abebef

You might also like