Professional Documents
Culture Documents
Testing programs to establish
the presence of system defects
D c
a d
a
esciagntes Prepdarets w
R ru
l
uitnhperostgdamCotm r
pasrtecsultp
o
r
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 9
Black-box testing
An approach to testing where the program is
considered as a ‘black-box’
The program test cases are based on the system
specification
Test planning can begin early in the software
process
e
s t
h a
n 43 4 B
e
twe7
n4
and101
0M
o
r
etha
n 10
Num berofin
p u
t919
v a
l00ues50091900
L
e s
tInputvalhuaens100B
©Ian Sommerville 2000
etw
en100and99M
orethan99
Software Engineering, 6th edition. Chapter 20 Slide 15
Search routine specification
procedure Search (Key : ELEM ; T: ELEM_ARRAY;
Found : in out BOOLEAN; L: in out ELEM_INDEX) ;
Pre-condition
-- the array has at least one element
T’FIRST <= T’LAST
Post-condition
-- the element is found and is referenced by L
( Found and T (L) = Key)
or
-- the element is not in the array
( not Found and
not (exists i, T’FIRST >= i <= T’LAST, T (i) = Key ))
id-point
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 24
Binary search - test cases
evlNLevlNL T e
ssqutincge
evlN
T e
s
tdrivrL evlN
–1L evlN–1L evlN
–1
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 35
Tetsing approaches
Architectural validation
• Top-down integration testing is better at discovering errors in the
system architecture
System demonstration
• Top-down integration testing allows a limited demonstration at an
early stage in the development
Test implementation
• Often easier with bottom-up integration testing
Test observation
• Problems with both approaches. Extra code may be required to
observe tests
ird e W
n t e
i
fa
i
etrhe rS t
a ti
on
Test cases are needed for all operations
Use a state model to identify state
e p o r t
W ea t h e
cteaslitb(r)ate(instrumr (
)ents)
transitions for testing
Examples of testing sequences
ssthaurttd
uopw(in
ns(itn
rum ents)
• Shutdown Waiting Shutdown
strum ents) •
•
Waiting Calibrating Testing Transmitting Waiting
Waiting Collecting Waiting Summarising
Transmitting Waiting
sum
send
reply
ackno (
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 50
Weather station testing
Thread of methods executed
• CommsController:request WeatherStation:report
WeatherData:summarise
Inputs and outputs
• Input of report request with associated acknowledge and a final
output of a report
• Can be tested by creating raw data and ensuring that it is
summarised properly
• Use the same raw data to test the WeatherData object
u
d c e m T
e
a
n s t
g r T
e
s
g
n
T
e
st
d
r
t
da
t
o
a
tr S
p
e
c
i
O
rf
a
t
i
o
a
c
l
en
iEy n am c P
axrecplutsrieornbeS ro
g
iinm a m Tes
t
tuleastordrulcomF
igR T
p
r
d
ie
s
t
c
o
n
s
lneppaoerarttorT
©Ian Sommerville 2000
estpreosults
Software Engineering, 6th edition. Chapter 20 Slide 53
Tetsing workbench adaptation
Scripts may be developed for user interface
simulators and patterns for test data generators
Test outputs may have to be prepared manually
for comparison
Special-purpose file comparators may be
developed