GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 1 of 16
Dealing with Inheritance in OO Evolutionary Testing
Javier Ferrer
, Francisco Chicano and Enrique [email protected]
Dealing with Inheritance in OO Evolutionary Testing
Javier Ferrer
, Francisco Chicano and Enrique [email protected]
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 2 of 16
3
Table of ContentsTable of Contents
Introduction
The Test Case Generator
Distance for instanceof
Experiments
Conclusions
1
2
4
5
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 3 of 16
After codification, software products require a test phase
The objective is to find errors
Object Oriented paradigm is followed by most software developers
Inheritance is an important issue of this paradigm
We propose a distance measure for the instanceof
operator that use the information of the class hierarchy
We define two mutation operators based on the distance
IntroductionIntroduction
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 4 of 16
Select a Partial Objective
Optimization Algorithm
End
Continue?yes
no
Test Case Generator
Test case
Objective function
Program
The
Test
Case GeneratorThe
Test
Case Generator
The
test
case generator
breaks
the
global objective
into
several
partial
objectives
Our generator creates a coverage table with the values that traverses each branch
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
Genetic Algorithm
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 5 of 16
Distance
for
instanceofDistance
for
instanceof
We
defined
an
objective
function
(fitness) to
be minimized
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
truefalse
o1
instanceof
c1
o2 instanceof
c2
Cond
C
Cond
B
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 6 of 16
Distance
for
instanceofDistance
for
instanceof
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
d=3h+2a
Hierarchical
walk= 3Approximation
walk= 2
ArrayList
instanceof
Integer
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 7 of 16
Distance
for
instanceofDistance
for
instanceof
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
d=2h+2a
ArrayList
instanceof
SetArrayList
instanceof
Integer
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 8 of 16
Distance-based
and
Uniform
MutationDistance-based
and
Uniform
Mutation
O1 O2 O3 O4 O5C1 C2 C3 C4 C5
O1 O2 O3 O4 O5C1 C2 C3 C4 C5O1 O2 O3 O4 O5C1 C2 C3 C4 C5
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing 9 of 16
Experiments: ProgramsExperiments: Programs
IntroductionThe Test Case Generator
Distance for instanceofExperiments
Conclusions
Setting
ParametersMutation
Operators
intanceof
expression
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing10 of 16
Experiments
: Approximation
and
Hierarchical
ConstantsExperiments
: Approximation
and
Hierarchical
Constants
h = 1 h = 25 h = 50 h = 100
a = 200 75.45 % 75.33 % 74.93 % 75.68 %
a = 100 75.53 % 74.74 % 75.10 % 74.79 %
a = 50 74.85 % 75.81 % 74.44 % 73.56 %
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
Setting
ParametersMutation
Operators
Does it hold that a>h?
Yes, because a
weights how close the test case is to satisfy the condition
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing11 of 16
Experiments: Distance-based
and
Uniform
mutationExperiments: Distance-based
and
Uniform
mutation
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
Setting
ParametersMutation
Operators
• Average of 200 executions
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing12 of 16
Experiments: Distance-based
and
Uniform
MutationExperiments: Distance-based
and
Uniform
Mutation
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
Setting
ParametersMutation
Operators
• Average of 200 executions
• MDn
is better than MU
• MU is faster at the beginning
New proposal:
Adaptive Mutation
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing13 of 16
Adaptive
Mutation
: New
ProposalAdaptive
Mutation
: New
Proposal
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
Setting
ParametersMutation
Operators
Distance
Prob
abilit
y
Distance Distance
Prob
abilit
y
Prob
abilit
y
Mutation
probability
VS Distance
between
classes
Adaptive
Speed
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing14 of 16
Adaptive
Mutation: ExperimentsAdaptive
Mutation: Experiments
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
Setting
ParametersMutation
Operators
100% coverage
obtained
in all
programs
The
GA with
adaptive
mutation
is
much
better
than
the
Random
Search
Difficult
to
test
is
correlated
to
the
expression
i + j
λ
Evals
i + j = 3
i + j = 4
i + j = 5
i + j = 6
i + j = 7
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing15 of 16
Combine our proposal with other OO features
Analysis of the impact of our proposal in real-world software
Conclusions
& Future
WorkConclusions
& Future
Work
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions
We created a test case generator able of dealing with inheritance
A new branch distance has been defined for inheritance
We have proposed and compared two mutation operators based on the
distance
The MDn
operator is better when using a greedy seeding of the GA
The number of atomic conditions and the nesting degree have a great
influence on the automatic testing complexity
GECCO 2009 Dealing with Inheritance in OO Evolutionary Testing16 of 16
THANKS FOR YOUR ATTENTION
Javier [email protected]
FINALFINAL
IntroductionThe Test Case Generator
Distance for instanceofExperimentsConclusions