0% found this document useful (0 votes)
20 views39 pages

Path Testing

White box testing is a software testing technique that examines the internal structure and logic of the program, requiring programming knowledge and is primarily used for unit and integration testing. Techniques include path testing and data flow testing, with path testing focusing on control structures and requiring a complete understanding of the program's structure. The document also discusses control flow graphs, independent paths, and provides examples of generating graphs and identifying paths in programs.

Uploaded by

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

Path Testing

White box testing is a software testing technique that examines the internal structure and logic of the program, requiring programming knowledge and is primarily used for unit and integration testing. Techniques include path testing and data flow testing, with path testing focusing on control structures and requiring a complete understanding of the program's structure. The document also discusses control flow graphs, independent paths, and provides examples of generating graphs and identifying paths in programs.

Uploaded by

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

White Box Testing

• White box testing is a testing technique, that


examines the program structure and derives test
data from the program logic/code.

• The other names are clear box testing, open box


testing, logic driven testing or path driven testing,
glass box testing or structural testing.
Criteria Black Box Testing White Box Testing

White Box Testing is a


Black Box Testing is a software
software testing method in
testing method in which the
which the internal structure/
Definition internal structure/ design/
design/ implementation of the
implementation of the item being
item being tested is known to
tested is NOT known to the tester
the tester.

Mainly applicable to higher levels Mainly applicable to lower


of testing: levels of testing:
Levels Applicable To
Acceptance Testing Unit Testing
System Testing Integration Testing

Generally,
Generally,
Responsibility Software Developers,
Independent Software Testers
Technically sound Testers

Programming Knowledge Not Required Required

Implementation Knowledge Not Required Required

Basis for Test Cases Requirement Specifications Detail Design


White Box Testing Techniques
• Path Testing

• Data Flow Testing


Path Testing
• Structural testing method
• Based on the source code / pseudo code of the
program or the system, and NOT on its specification
PATH TESTING
Path Testing
1.Path testing is based on control structure of the program for
which control flow graph is prepared .

2.Path testing requires complete knowledge of the program's


structure.

3.Choose total path or enough path in a program such that


maximum logic coverage is achieved.

4.The effectiveness of path testing gets reduced with the increase


in size of software under test.
Control Flow Graph:
• The control flow graph is graphical representation of
control structure of a graph.

•Flow graph can be prepared as a directed graph.

•A directed graph (V,E) consists of a set of vertices V and


set of edges E .

•Based on the Concepts of directed graph , following


notations are used for a flow graph.
• Node: It represents one or more procedural statements .
The nodes are denoted by a circle. These are numbered or
labeled
• Edge or Links : They represent the flow of control in a
program. This is denoted by an arrow on the edge. An edge
must terminate at a node.
• Decision Node : A node with more than one arrow leaving it
is called a decision node.
• Junction Node: A node with more than one arrow entering it
is called a junction.
• Regions : Areas bounded by edges and nodes are called
regions. When counting the regions , the area outside the
graph is also considered a region.
• Path : A path through a program is a sequence of
instructions or statements that starts at an entry, junction
or decision and ends at another , or possibly the same,
junction , decision, or exit. A path may go through several
junction processes, or decisions, one or more times.

• Length of a path: The length of path is measured by the


number of links or edge in it and not by the number of
instructions or statements executed along the path.
• Independent Path : An independent path is any path
through the graph that introduces at least one new
set of processing statements or new conditions. An
independent path must move along at least one
edge or node that has not been traversed before the
path is defined.

• Some well defined formula is also used for reference


to identify the total number of independent path.
Flow Graph
Problem solving steps for given program
•Program Graph :Generation of graph from program

•Mapping Table (For reference to map for make DD , Write the


numbering in sequence like A,B,C or i,ii,iii or 1,2,3 etc… )

•DD path graph(Decision to Decision ): A CFG can be converted


into DD-paths, the resulting graph is called a DD-path graph of
the program
•DD path graph is used to find total number of path

•Write the independent path.


Control Flow graph (Example 1)

1. a=5; Sequence 1 2

2. b=a*2-1;
1
1. If(a>b) 3
Selection 2
2. C=3
3. Else c=5 4

4. C=c*c
CFG (Example 2)
1. While(a>b){ 1
2. b=b-1;
Iteration
3. b=b*a;} 2

4. C=a+b; 3

4
CFG(Example: 3)
1
1. While(x!=y){
2. If(x>y)then
2
3. X=x-y;
4
4. Else y=y-x; 3
5. }
5
6. Return x;

6
Example : 7

Next
Quadratic Equation

11 F
21,25,29
17 F

30,33,36

Program : Quadratic Equation


Solution
Program Graph
DD Path Graph
DD Path Graph
DD Path Graph
Total No of Path
II
I
III

2
5 1
4
3
Independent (basis) paths
• Independent path is a path through a DD-path graph
of the program which cannot be reproduced from
other paths
• At least one node or edge is new .
• Minimum Number of path (edge).
• Condition Coverage
Independent Path
Example 8
Consider a program 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 and DD path graph . Also find the
independent paths from DD path graph.
10 F

For Triangle problem


Merge
18 F

For Triangle problem


Program Flow Graph
DD Path Graph
DD Path Graph
L
Example 9:
Make the program graph/control program graph and
DD Path Graph for given example.
Example 9:
CFG
CFG
Mapping Table for DD Path

Node DD-Path Name

1 Source
2-4 A
5 B
6 C
7 D
8 E
… …
19 Sink
CFG to DD-Path

You might also like