Introduction To Software Testing Why Do We Test Software?: Paul Ammann & Jeff Offutt
Introduction To Software Testing Why Do We Test Software?: Paul Ammann & Jeff Offutt
Introduction To Software Testing Why Do We Test Software?: Paul Ammann & Jeff Offutt
(2nd edition)
Chapter 1
Why Do We Test Software?
Paul Ammann & Jeff Offutt
h //
http://www.cs.gmu.edu/~offutt/softwaretest/
d / ff / f
/
Industry is going
through
h
h a revolution
l i in
i
what testing means to
the success of software
products
Embedded Control Applications
iis muchh bigger
bi
is more competitive
has more users
PDAs
memory seats
DVD players
garage door openers
cell phones
Thee web o
offers
e s a new
ew deployment
dep oy e platform
pa o
Very competitive and very available to more users
Web apps are distributed
Web apps must be highly reliable
A Concrete Example
Fault: Should start
searching at 0, not 1
p
public
static int numZero ((int [ ] arr))
Test 1
{ // Effects: If arr is null throw NullPointerException
[ 2, 7, 0 ]
// else return the number of occurrences of 0 in arr
Expected: 1
int count = 0;
Actual: 1
for (int i = 1; i < arr.length; i++)
{
Error: i is 1, not 0,
Test 2
if (arr [ i ] == 0)
on the first iteration
[ 0, 2, 7 ]
{
Failure: none
Expected: 1
count++;
t++
Actual: 0
}
}
Error: i is 1, not 0
return count;
Error propagates to the variable count
}
Failure: count is 0 at the return statement
BUG
It
so in
The
has been just
j
i all off my inventions.
i
i
first step is an intuition, and comes with a burst,
then difficulties arisethis thing gives out and
[it is] then that 'Bugs'as such little faults and
difficulties are calledshow themselves and
months of intense watching, study and labor are
requisite. . . Thomas Edison
Introduction to Software Testing, Edition 2 (Ch 1)
THERAC-25 design
Lander crash
site?
destruct on maiden
flight (64-bit to 16-bit
conversion: about
370 million $ lost)
10
11
12
13
14
Level 0 Thinking
Testing
Does
Does
safe
15
Level 1 Thinking
Purpose
is to show correctness
Correctness is impossible to achieve
What do we know if no failures?
Good software or bad tests?
Test
Strict goal
Real stopping rule
Formal test technique
Test managers are powerless
16
Level 2 Thinking
Purpose
is to show failures
Looking
g
Puts
What
17
Level 3 Thinking
Testing
Whenever
Risk
Risk
Testers
18
Level 4 Thinking
A mental discipline that increases quality
19
20
10
Common
21
software
f
system
for the mac
V.1.5.1
Jan/2007
Jan/2011
MF2-HD
1.44 MB
DataLife
Verdatim
22
11
Threshold
What
reliability requirements?
Requirements
23
1990s Thinking
Naw - I already
dont plow as good
as I know how...
Fail !!!
Knowing is not enough, we must apply. Willing is not enough, we must do.
do.
Goethe
Introduction to Software Testing, Edition 2 (Ch 1)
Ammann & Offutt
24
12
25
50
40
30
20
10
0
26
13
27
14