Professional Documents
Culture Documents
Testing 1 PDF
Testing 1 PDF
Testing 1 PDF
No issue is meaningful unless it can be put to the test of decisive verification. C.S. Lewis, 1934
2001-10-10
2001-10-10
2001-10-10
Statement Coverage
Begin if ( y >= 0) then y = 0; abs = y; end; test case-1:
input: y = 0 expected result: 0 actual result: ?
2001-10-10 PUM-I, Mariam Kamkar, IDA 5
begin y >= 0
yes
y=0 abs = y
Branch Coverage
Begin if ( y >= 0) then y = 0; abs = y; end;
test case-1: input: y = 0 expected result: 0 actual result: ?
2001-10-10
begin y >= 0
no yes
y=0
Begin if ( x < 10 && y > 20) { z = foo (x,y); else z =fie (x,y); } end;
test case-1: input: x = -4, y = 30 expected result: ... actual result: ?
2001-10-10 no
yes
z=fie (x,y)
z=foo (x,y)
Path Coverage
no
x <> 0
yes
x = 0, z = 12 x = 2, z = 6 z = sin(x)
z = z-x
yes
z > 10
no
z=0
z=z/x
x = 0, z = 7 x = 0, z = 13 x = 1, z = 5 x = 2, z = 15
2001-10-10
a d b c e
a c,b,d e d
2001-10-10
10
Input
P r o g r a m
Output
Failure?
Oracle
2001-10-10 PUM-I, Mariam Kamkar, IDA 11
2001-10-10
12
2001-10-10
13
Failure
2001-10-10
14
2001-10-10
15
output
2001-10-10 PUM-I, Mariam Kamkar, IDA 16
2001-10-10
17
Equivalence partitioning
Invalid inputs
Valid inputs
outputs
2001-10-10 PUM-I, Mariam Kamkar, IDA 18
Specification: the program accepts four to eight inputs which are 5 digit integers greater than 10000.
input values
Less than 10000 Between 10000 and 99999 More than 99999
Between 4 and 8
More than 8
19
Guidelines
If an input condition specifies a range: one valid and two invalid equivalence classes. A specific value: one valid and two invalid equivalence classes. A member of a set: one valid and one invalid equivalence classes. A boolean: one valid and one invalid class.
2001-10-10 PUM-I, Mariam Kamkar, IDA 20
10
99999 100000
2001-10-10
21
Cause-Effect
#AUSES
C1: command is credeit C2: command is debit C3: account number is valid C4: transaction amount is valid
%FFECTS
E1: print invalid command E2: print invalid account
number
E3: print debit amount not valid E4: debit account print E5: credit account print
2001-10-10
22
11
C2
C3
not
and
E3
C4
2001-10-10
23
(d1-i), (u1-i)
24
12
du-s
(d1-s) (d2-i) (u1-i, u2-n) (u3-s, u4-i, d3-s) (u5-i, d4-i) (u6-s) (u7-i) (u8-n)
PUM-I, Mariam Kamkar, IDA
26
13
Program Slicing
s = 0; i = 1; while (i <= n) { s + = i; i ++ } print (s); print (i); print (n); i = 1; while (i <= n) { i ++ } print (i);
2001-10-10
27
2001-10-10
28
14
2001-10-10
2001-10-10
30
15
Components
driver Boundary conditions independent paths interface ...
Component to be tested
stub
stub
Test cases
2001-10-10
31
2001-10-10
32
16
2001-10-10
33
Bottom-up
ABCDEFG
BEF
DG
2001-10-10
34
17
Top-down
ABCD
ABCDEFG
2001-10-10
35
System Testing
Recovery testing (fault tolerant) Security testing Stress testing (volume, resources,) Performance testing (real-time, embedded system)
2001-10-10
36
18
Acceptance Testing
Alpha test: at the developers site, controlled environment Beta test: at one or more customer site.
2001-10-10
37
2001-10-10
38
19
Oracle
Scaffolding
2001-10-10
39
Harder
2001-10-10
40
20
1970
Establish confidence
1972 June, First formal conference software testing, university of North Carolina, Bill Hetzel.
1960
1957, Charles Baker distinguished debugging from testing
1950
2001-10-10
41
And
Testing can show the presence, but never the absence of errors in software. E. Dijkstra, 1969
2001-10-10
42
21