19 Testing
19 Testing
Continuous Integration
Kenneth M. Anderson
University of Colorado, Boulder
CSCI 5828 — Lecture 19 — 03/17/2009
© University of Colorado, 2009
1
Goals 2
Unit Tests
Tests that cover low-level aspects of a system
For each module, does each operation perform as expected
Integration Tests
Tests that check that modules work together in combination
Most projects on schedule until they hit this point
All sorts of hidden assumptions are surfaced when code written
by different developers are used in tandem
Lack of integration testing has led to spectacular failures
Testing the System (II) 13
System Tests
Tests performed by the developer to ensure that all major
functionality has been implemented
Have all user stories been implemented and function correctly?
Acceptance Tests
Tests performed by the user to check that the delivered
system meets their needs
In large, custom projects, developers will be on-site to install
system and then respond to problems as they arise
Multi-Level Testing 14
15
System
15
Input System
15
Input System Actual Output
15
Input System Actual Output
Spec
15
Input System Actual Output
15
Input System Actual Output
== ??
Process
Write at least one test case per functional capability
Iterate on code until all tests pass
Need to automate this process as much as possible
Black Box Categories 17
Functionality
User input validation (based off specification)
Output results
State transitions
are there clear states in the system in which the system is
supposed to behave differently based on the state?
Boundary cases and off-by-one errors
Grey Box Testing 18
12
White‐box
Tes?ng
Criteria
Statement
Coverage
Select
a
test
set
T
such
that,
by
executing
P
for
each
d
in
T,
each
elementary
statement
of
P
is
executed
at
least
once
All‐Statements
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
12
All‐Statements
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-statements-adequate test set:
12
All‐Statements
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-statements-adequate test set:
(X = 20, Y = 10)
12
All‐Statements
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-statements-adequate test set:
(X = 20, Y = 10)
(X = 20, Y = 30) 12
White‐box
Tes?ng
Criteria
Edge
Coverage
Select
a
test
set
T
such
that,
by
executing
P
for
each
d
in
T,
each
edge
of
P’s
control
flow
graph
is
traversed
at
least
once
All‐Edges
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
12
All‐Edges
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-edges-adequate test set:
12
All‐Edges
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-edges-adequate test set:
(X = 20, Y = 10) 12
All‐Edges
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-edges-adequate test set:
(X = 20, Y = 10) 12
(X =15, Y = 30)
White‐box
Tes?ng
Criteria
Condition
Coverage
Select
a
test
set
T
such
that,
by
executing
P
for
each
d
in
T,
each
edge
of
P’s
control
flow
graph
is
traversed
at
least
once
and
all
possible
values
of
the
constituents
of
compound
conditions
are
exercised
at
least
once
All‐Condi?ons
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
12
All‐Condi?ons
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-conditions-adequate test set:
12
All‐Condi?ons
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-conditions-adequate test set:
(X = 20, Y = 10) 12
All‐Condi?ons
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-conditions-adequate test set:
(X = 20, Y = 10) 12
(X = 5, Y = 30)
All‐Condi?ons
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
Example all-conditions-adequate test set:
(X = 20, Y = 10) 12
(X = 5, Y = 30)
(X = 21, Y = 10)
White‐box
Tes?ng
Criteria
Path
Coverage
Select
a
test
set
T
such
that,
by
executing
P
for
each
d
in
T,
all
paths
leading
from
the
initial
to
the
final
node
of
P’s
control
flow
graph
are
traversed
at
least
once
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
F F
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
All‐Paths
Coverage
of
P
6 7 10
F
T T T
F T
2,3,4 5 9 9′ 14
Example all-paths-adequate test set:
F F
(X = 5, Y = 10)
(X = 15, Y = 10) 12
(X = 25, Y = 10)
(X = 35, Y = 10)
…
Code Coverage Tools 76