Chapter 4 Test Case Design V1
Chapter 4 Test Case Design V1
1
Test Case Design
Part –I Black Box Testing
Part –II White Box Testing
2
LESSON OUTLINE
Black Box Testing (Functional testing)
Equivalence Partitioning
Boundary Value Analysis
Cause Effect Graphing
White Box Testing (Structural testing)
Coverage Testing
Statement Coverage
Path Coverage
19
Example: Credit Card issuance validation test cases
21
Cont’d …
Example: Flight Reservation Login States Transition
22
Cont’d …
Example: All Valid and Invalid States
23
:WHITEBOX TESTING:
White Box Testing (also known as Clear Box Testing, Open Box
Testing, Glass Box Testing, Transparent Box Testing, Code-Based
Testing or Structural Testing) is a software testing method in
which the internal structure/ design/ implementation of the
item being tested is known to the tester.
White Box Testing is like the work of a mechanic who examines
the engine to see why the car is not moving.
Using white-box testing methods, you can derive test cases that
However this test case won’t give you 100% decision coverage as
the FALSE condition of the IF statement is not exercised.
In order to achieve 100% decision coverage we need to exercise
the FALSE condition of the IF statement which will be covered
when X is less than Y.
:WHITEBOX TESTING:
Example:…
So the final TEST SET for 100% decision coverage will be:
2 2
3 R3
3
6 4 6 4
R2
7 8 5
7 R1 8 5
9
9
11 10 11 10
37
Path Testing – Independent Paths
Defined as a path through the program from the start node until
the end node that introduces at least one new set of processing
statements or a new condition (i.e., new nodes)
Must move along at least one edge that has not been traversed
before by a previous path
Basis set for flow graph on previous slide
Path 1: 0-1-11
Path 2: 0-1-2-3-4-5-10-1-11
Path 3: 0-1-2-3-6-8-9-10-1-11
Path 4: 0-1-2-3-6-7-9-10-1-11
The number of paths in the basis set is determined by the
cyclomatic complexity
38
Path Testing – Cyclomatic Complexity
Provides a quantitative measure of the logical complexity of a program
Defines the number of independent paths in the basis set
Provides an upper bound for the number of tests that must be conducted
to ensure all statements have been executed at least once
Can be computed three ways
The number of regions
V(G) = E – N + 2, where E is the number of edges and N is the number of
nodes in graph G
V(G) = P + 1, where P is the number of predicate nodes in the flow graph G
Results in the following equations for the example flow graph
Number of regions = 4
V(G) = 14 edges – 12 nodes + 2 = 4
V(G) = 3 predicate nodes + 1 = 4
39
Path Testing Note: Test cases
After determining the independent paths, design
test cases for each path
The minimum number of test cases is equal to the
cyclomatic complexity.
Problem – path testing cannot test all possible
combinations of paths through a program. There
are an infinite number of possible path
combinations in programs with loops
IN GENERAL…
Number of Number of
test cases
program
Paths required for
branch
coverage
Path Branch
Coverage Coverage
:COMPARISON OF BLACKBOX TESTING AND
WHITEBOX TESTING:
:COMPARISON OF BLACKBOX TESTING AND
WHITEBOX TESTING:
White Box and Black Box Testing: Notes
44
Choosing test Techniques
47