Академический Документы
Профессиональный Документы
Культура Документы
Software testing
Exhaustive testing
There are 1014
possible paths!
If we execute one
test per millisecond,
it would take 3.170
years to test this
program!!
Out of question
loop < 20x
Testability =
how easy can a program be tested
Features that help/influence testing:
operability - it operates cleanly
observability
the results are easy to see
distinct output is generated for each input
incorrect output is easily identified
controllability
processing can be controlled
tests can be automated & reproduced
developer
independent tester
function/method to be
tested
anAgent is in the
ResourcePool
function to be tested
removeAgent(anAgent)
removeAgent(anAgent)
ResourcePool =
ResourcePool\anAgent
AgentNotFoundException is
thrown
OBJECTIVE
to uncover errors
CRITERIA
in a complete manner
CONSTRAINT
Guaranteed cover:
Exhaustive testing
But:
There are 520=1014
(approx.) possible
paths!
If-then-else
Better:
Selective testing
a selected path
Cyclomatic complexity
A number of industry studies have indicated that
the higher V(G), the higher the probability of
errors.
modules
V(G)
modules in this range are
more error prone
CPSC 333: Foundations of Software Engineering
2
4
3
5
Path 1:
1,2,3,6,7,8
Path 2:
1,2,3,5,7,8
Path 3:
1,2,4,7,8
Path 4:
1,2,4,7,2,47,8
6.1.5. Loops
Cornerstone of every program
Loops can lead to non-terminating programs
Loop testing
simple loop
nested
loops
concatenated
loops
unstructured
loops
Nested loops
Just extending simple loop testing:
number of tests explodes
Reduce the number of tests:
start at the innermost loop; set all other
loops to minimum values
conduct simple loop test; add out of range
or excluded values
work outwards while keeping inner nested
loops to typical values
continue until all loops have been tested
CPSC 333: Foundations of Software Engineering
Categories of errors in
black box testing
incorrect or missing functions
interface errors
errors in data structures or external database
access
performance errors
initialization and termination errors
Example
abs(integer x)
Return x if x >= 0
Return -x if x<0
The concrete value of x does not matter!
Basis for Equivalence Testing
user
queries
numerical
data
Partitioning is based
on input conditions
output
format
requests
responses
to prompts