Introduction To Software Testing Engineering Criteria For Technologies
Introduction To Software Testing Engineering Criteria For Technologies
Chapter 7.1
Engineering Criteria for Technologies
http://www.cs.gmu.edu/~offutt/softwaretest/
The Technologies
Chapters 1-5 emphasize criteria on four models of software
1. Object-Oriented Software
2. Web Applications and Web Services
3. Graphical User Interfaces
4. Real-Time and Embedded Software
A
In Java, the method that is executed is
the lowest version of the method defined B
between the actual and declared types in
the inheritance hierarchy C
default
private members
inheritance
Class 2
Class 5 Class 4
Introduction to Software Testing (Ch 7) © Ammann and Offutt 7
Polymorphism
The same variable can have different types depending on the
program execution
human
This gives a
deer access
to “hands” !
deer
Introduction to Software Testing (Ch 7) © Ammann and Offutt 9
Testing OO Software
W
v
u • W::m () defines v and W::n() uses v
m()
n() • X::n () uses v
W
v
u • Y overrides W’s version of v
m()
n() • Y::m() defines Y::v
W()
When an object of type X is constructed,
Calls W() is run before X().
f()
Overrides When W() calls X::f(), x is used, but has
X not yet been given a value!
x
Uses
X()
f()
Introduction to Software Testing (Ch 7) © Ammann and Offutt 24
State Visibility Anomaly (SVA)
A private variable v is declared in ancestor W, and v is defined
by W::m()
X extends W and Y extends X
Y overrides m(), and calls W::m() to define v
W W
-v -v
m() Overrides m()
Overrides,
calls
X X
X::m() is added later
X::m() does not call W::m()
Overrides, m()
calls Y:m() can no longer call W::m(),
Y Y
so v is not defined!
m() m()
def
A( M A() def
A()
) () A()
M()
B( use N(
) ) B() use
B()
N() B()
F F(
() )
object-oriented direct object-oriented indirect
coupling data flow coupling data flow
Introduction to Software Testing (Ch 7) © Ammann and Offutt 28
Coupling-Based Testing (from Ch 2)
Test data and control
connections
Caller
Derived from previous work x = 14 last-def-before-call
F
for procedural programs
y = G (x) call site
Based on insight that print (y) first-use-after-call
integration occurs through
couplings among software Callee
G (a) print (a) first-use-in-callee
artifacts
b = 42 last-def-before-
return
return (b)
public void f ( W o )
{
…
Set of methods that can potentially
execute as result of a method call j o.m();
through a particular instance …
context
l o.l();
pcs (o.m) = {W::m, Y::m, X::m} …
k o.n();
}
l ()
j o.l()
X Z
-x :
def (W::u)
+n() +m()
+n()
n ()
k o.n()
Y Coupling
-w : Couplingwith
sequence use (W::u)
+m()
+l()
sequence
respect with
to W::u use (W::v)
respect to W::v
l ()
j o.l()
X Z
-x : -x :
def (W::u)
+n() +m()
+n()
n ()
k o.n()
Y
-w : Coupling use (Z::x)
+m()
+l()
sequence with use (Z::x)
respect to Z::x
All-Poly-Coupling
Defs-Uses
APDU
All-Poly- All-Coupling-
Classes Defs-Uses
APC ACDU
All-Coupling-
Sequences
ACS