SENG 438
Software Testing,
Reliability and Quality
Chapter 5A: White-box Testing
Control-flow Coverage
Kangsoo Kim, PhD (
[email protected])
Department of Electrical & Software Engineering
Schulich School of
...
SENG 438
Software Testing,
Reliability and Quality
Chapter 5A: White-box Testing
Control-flow Coverage
Kangsoo Kim, PhD (
[email protected])
Department of Electrical & Software Engineering
Schulich School of Engineering
University of Calgary2
Contents
• Preliminary: Control Flow Graph (CFG)
• Control flow
• Statement/Node/Line Coverage
• Decision/Edge/Branch Coverage
• Condition Coverage
• Path Coverage
• Cyclomatic complexity
• Data flow
• Coverage tools
Our focus in this week
Next week3
Review: Black- vs. White-box
• Black-box testing
• Testing, either functional or non-functional, without reference to the
internal structure of the component or system
• Synonyms: specification-based testing
• White-box testing
• Procedure to derive and/or select test cases based on an analysis of the
internal structure of a component or system
• Synonyms: structural, glass box, open box testing4
Review: Black- vs. White-box
• Also known as structural testing, glass box or open box testing
• A software testing technique in which explicit knowledge of the
internal working of SUT is used to select tests, execute tests and
collect test data
• Unlike black box testing that is using the program specification
to examine outputs, white box testing is based on specific
knowledge of the source code to define the test cases and to
examine outputs5
Review: Black- vs. White-box
• How do black- and white-box testing relate to one another in
real-world projects?Section 1:
[Preliminary]
Control Flow Graph (CFG)7
How to Represent Program Structure?
Software structure can have 3 attributes:
• Data structure: The organization of data itself independent of
the program
• Control-flow structure: Sequence of execution of instructions of
the program (execution of code lines)
• Data flow: Keeping track of data as it is created or handled by
the program
Static Dynamic8
Preliminary: Graph
• Graphs are the most commonly used structure for white-box
testing
• A graph is
• A set N of nodes, N is not empty
• A set N
0 of initial nodes, N0 is not empty
• A set N
f of final nodes, Nf is not empty
• A set E of edges, each edge from one node to another
• ( ni , nj ), i is predecessor, j is successor
• We usually intend to “cover” the graph equivalent to a program
block through testing
Introduction to Software Testing, © Ammann & Offu
[Show More]