Lab12 PDF
Lab12 PDF
Except where otherwise noted, the contents of this document are Copyright 2017 Gwanggyu Choi, Youn-geun
Ahn and Scott Uk-Jin Lee All rights reserved. Any redistribution, reproduction, transmission, or storage of part
or all of the contents in any form is prohibited without author’s expressed written permission.
White-box Testing
Testing should be designed under these philosophies
• Guarantee that all independent paths within a module have been
executed at least once.
• Execute all logical decisions on their true and false sides.
• Execute all loops at their boundaries and within their operational
bounds.
• Execute internal data structures to ensure their validity.
Basis Path Testing
Basis path testing is a white-box method for designing
test cases.
• The method analyzes the control flow graph of a program to find a
set of linearly independent paths of execution.
• The method uses McCabe’s cyclomatic complexity to determine
the number of linearly independent paths and then generate test
cases for each path thus obtained.
Control Flow Graph Notation
The flow graph depicts logical control flow
• Lines called edges represent flow of control
• Circles called nodes represent one or more actions
• Areas bounded by edges and nodes called regions
• A predicate node is a node containing a condition
Control Flow Graph Example
Calculate Cyclomatic Complexity
Cyclomatic complexity is a software metric that, used to
indicate the complexity of a program.
6
7 .
8 9
Determine a Basis paths set
Path 1: 1 11
Path 2: 1 2 3 5 6 7 10 1 11
Path 3: 1 2 3 5 6 8 10 1 11
Path 4: 1 2 3 5 6 9 10 1 11
Path 5: 1 2 4 5 6 9 10 1 11
Path X: 1 2 3 5 6 7 10 1 2
3 5 6 8 10 1 2 4
5 6 9 10 1 11
Exercise 1. Basis Path Testing
Using pseudo code for bubble sort
1. Draw Control Flow Graph
2. Calculate Cyclomatic Complexity
3. Determine a basis set of paths
Submission
1. Take a picture your
CFG, Cyclomatic complexity, Basis Paths.
(if you draw them to computer, capture them)
3. Send [email protected]
(mail title: [Lab12]Yourname)