1.
White Box Testing
Basis Path Testing
Control Structure Testing
2. Black Box Testing
Equivalence Partioning Testing
Boundary Value Analysis
Cause Effect Graph
Basis Path Testing
Basis path testing is a type of white-box testing that tests all
possible independent paths in the control flow graph of a
program. It was developed by Tom McCabe.
A path is the route of nodes in the control flow graph that a
program takes from one point to another.
An independent path is a path that adds at least one node in the
already defined independent paths. In other words, the
independent paths of a program are all unique.
Steps for basis path testing
To conduct basis path testing of a program, follow the steps below:
1. Draw the control flow graph of the program.
2. Calculate the cyclomatic complexity of the control flow graph. This
will be the maximum number of independent paths in the graph.
3. Identify independent paths in the control flow graph.
4. Design test cases based on the independent paths identified so that
the test cases execute all independent paths.
Control Flow Graph
Flow Graph Notation
A simple notation for the representation of control flow, called a flow graph.
Below are the notations used while constructing a flow graph :
Sequential Statements –
If – Then – Else –
Cyclomatric Complexity
Cyclomatric Complexity is a software metric that provides a quantitative
measure of the logical complexity of a program Complexity is computed in one
of three ways:
The number of regions of the flow graph corresponds to the cyclomatic
complexity.
Cyclomatic complexity V(G) for a flow graph G is defined as
V(G) = E-N+2
E- Edges, N – Num of Nodes
Cyclomatic Complexity V(G) for a flow graph G is also defined as V(G) = P+1
P – Num of Predicate nodes contained in the flow graph G.
Program “Find Greatest Number”
1
1. INPUT(A)
2. INPUT(B)
2
3. IF(A>B)
4. THEN PRINT(A)
5. ELSE IF(B>A) 3
6. THEN PRINT(B)
7. ELSE
8. PRINT BOTH 4 5
9. END IF
[Link] IF
11. EXIT
6 7
9
8
10
2. Calculate cyclomatic complexity
The cyclomatic complexity of the control flow graph above will
be:
1. Cyclomatic Complexity = E-N+2
Cyclomatic Complexity = 11-10+2=3
2. Cyclomatic Complexity = P+1=2+1=3
3. Independent Paths :
An independent path in the control flow graph is the one which
introduces at least one new edge that has not been traversed
before the path is defined.
The cyclomatic complexity gives the number of independent
paths present in a flow graph.
independent paths is equal to the cyclomatic complexity
For the above flow graph we can calculate the independent path
is:
1-2-3-4-9-10
1-2-3-5-6-8-9-10
1-2-3-5-7-8-9-10
Number of Independet Path is : 3
Cyclomatic Complexity is always equal to number of
Independent path.
4. Deriving test cases
Prepare the test cases that will force execution of each path is
the basis path.
Advantages of basis path testing
The advantages of conducting basis path testing are:
Basis path testing reduces the number of redundant tests.
All program statements are executed and tested at least
once.
It guarantees complete branch coverage.
2. Control Structure Testing
Condition Testing
It is a test case design method that exercise the
logical conditions contained in a program module.
Data Flow Testing
Data flow testing method selects test paths of a
program according to the locations of definitions and uses of
variables in the program.
Loop Testing
Loop testing is a White Box Testing Technique
that exclusively on the validity of loop constructs.