Towards effective mutation testing for ATL
Esther Guerra, Juan de Lara
Universidad Aut´onoma de Madrid (Spain)
Jes´us S´anchez Cuadrado
Universidad de Murcia (Spain)
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 1 / 30
miso.es
Introduction
Model transformations
Importance of correctness of model transformations
Testing of transformations helps in detecting errors
How do you know if you did enough tests?
Mutation testing to the rescue!
It permits quantifying the quality of a test suite
Based on injecting artificial faults in the program under test
If test suite detects the artificial faults, it will likely detect real errors
Our focus is on mutation testing for ATL
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 2 / 30
Introduction
Mutation testing
Input
ATL transformation to test
Test suite made of:
input models (manual vs automatic)
oracle function (partial vs total)
Challenge: Identify the best test input
model generation technique
good at finding errors
few models if possible
test cases
program
under test
INPUT
1
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 3 / 30
Introduction
Mutation testing
Mutation operators
Mimic errors of competent developers
Used to create mutants of the program
Operators for ATL exist, but do not
mimic real errors
Challenge: Design operators based on
errors made by ATL developers
mutant
programs
mutation
operators
test cases
2
program
under test
INPUT
2
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 4 / 30
Introduction
Mutation testing
Mutation score
For each mutant, execute test suite
against mutant and original program
Compare results
if different, the mutant is killed
otherwise, it is alive (undetected error)
Mutation score =
killed mutants / total mutants
The higher the score, the better the
quality of the test suite
mutant
programs
mutation
operators
live mutants killed mutants
mutation score
test cases
yes no
3
program
under test
INPUT
mutant test
==
original test
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 5 / 30
Introduction
Mutation testing
On effectiveness
Mutation testing is very expensive
(many potential mutants)
Careful selection of mutation operators
do not produce trivial mutants
produce hard-to-kill mutants
Challenge: Analyse the effectiveness of
operators for ATL, which is unknown
mutant
programs
mutation
operators
live mutants killed mutants
mutation score
test cases
yes no
3
program
under test
INPUT
mutant test
==
original test
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 6 / 30
Introduction
Mutation testing
Improving the test suite
Add input models that kill live mutants
Challenge: Devise a technique to
synthesize mutant-killer models for ATL
mutant
programs
mutation
operators
live mutants killed mutants
mutation score
additional
test cases
test cases
yes no
program
under test
INPUT
mutant test
==
original test
4
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 7 / 30
Contributions
Mutation operators for ATL
new operators that mimic frequent ATL developer errors
evaluation of efficacy of these and other operators
Test suite
evaluation of efficacy of three test model generation techniques:
random, meta-model coverage, transformation coverage
novel technique to generate input models that kill live mutants
Open-source tool for mutation testing of ATL
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 8 / 30
A Brief Tour
of
ATL
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 9 / 30
ATL
Atlas Transformation Language
Widely used model transformation language
Dynamic, testing is needed to avoid runtime errors
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 10 / 30
ATL by example
create OUT : Relational from IN : Class
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = −1 then true
else self.upperBound > 1 endif;
rule Class2Table {
from c : Class!Class ( not c.isAbstract )
to out : Relational!Table (
name <− c.name,
col <− Sequence{key}→union(c.att→select(e | not e.multiValued)),
key <− Set{key} ),
key : Relational!Column ( name <− ’objectId’ )
}
rule MultiValuedDataTypeAttribute2Column {
from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued )
to out : Relational!Table (
name <− a.owner.nameOrEmpty + ’ ’ + a.name,
col <− Sequence {thisModule.createIdColumn(a.owner), value} ),
value : Relational!Column ( name <− a.name )
}
lazy rule createIdColumn {
from ne : Class!NamedElt
to key : Relational!Column ( name <− ne.name )
}
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
ATL by example
create OUT : Relational from IN : Class // input and output meta−models
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = −1 then true
else self.upperBound > 1 endif;
rule Class2Table {
from c : Class!Class ( not c.isAbstract )
to out : Relational!Table (
name <− c.name,
col <− Sequence{key}→union(c.att→select(e | not e.multiValued)),
key <− Set{key} ),
key : Relational!Column ( name <− ’objectId’ )
}
rule MultiValuedDataTypeAttribute2Column {
from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued )
to out : Relational!Table (
name <− a.owner.nameOrEmpty + ’ ’ + a.name,
col <− Sequence {thisModule.createIdColumn(a.owner), value} ),
value : Relational!Column ( name <− a.name )
}
lazy rule createIdColumn {
from ne : Class!NamedElt
to key : Relational!Column ( name <− ne.name )
}
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
ATL by example
create OUT : Relational from IN : Class
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = −1 then true
else self.upperBound > 1 endif;
rule Class2Table { // matched rule
from c : Class!Class ( not c.isAbstract ) // input pattern with filter
to out : Relational!Table ( // output pattern
name <− c.name,
col <− Sequence{key}→union(c.att→select(e | not e.multiValued)),
key <− Set{key} ),
key : Relational!Column ( name <− ’objectId’ )
}
rule MultiValuedDataTypeAttribute2Column {
from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued )
to out : Relational!Table (
name <− a.owner.nameOrEmpty + ’ ’ + a.name,
col <− Sequence {thisModule.createIdColumn(a.owner), value} ),
value : Relational!Column ( name <− a.name )
}
lazy rule createIdColumn {
from ne : Class!NamedElt
to key : Relational!Column ( name <− ne.name )
}
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
ATL by example
create OUT : Relational from IN : Class
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = −1 then true
else self.upperBound > 1 endif;
rule Class2Table {
from c : Class!Class ( not c.isAbstract )
to out : Relational!Table (
name <− c.name, // binding
col <− Sequence{key}→union(c.att→select(e | not e.multiValued)), // binding
key <− Set{key} ),
key : Relational!Column ( name <− ’objectId’ )
}
rule MultiValuedDataTypeAttribute2Column {
from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued )
to out : Relational!Table (
name <− a.owner.nameOrEmpty + ’ ’ + a.name,
col <− Sequence {thisModule.createIdColumn(a.owner), value} ),
value : Relational!Column ( name <− a.name )
}
lazy rule createIdColumn {
from ne : Class!NamedElt
to key : Relational!Column ( name <− ne.name )
}
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
ATL by example
create OUT : Relational from IN : Class
helper context Class!Attribute def: multiValued : Boolean = // helper, similar to a function
if self.upperBound = −1 then true
else self.upperBound > 1 endif;
rule Class2Table {
from c : Class!Class ( not c.isAbstract )
to out : Relational!Table (
name <− c.name,
col <− Sequence{key}→union(c.att→select(e | not e.multiValued)), // helper invocation
key <− Set{key} ),
key : Relational!Column ( name <− ’objectId’ )
}
rule MultiValuedDataTypeAttribute2Column {
from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued )
to out : Relational!Table (
name <− a.owner.nameOrEmpty + ’ ’ + a.name,
col <− Sequence {thisModule.createIdColumn(a.owner), value} ),
value : Relational!Column ( name <− a.name )
}
lazy rule createIdColumn {
from ne : Class!NamedElt
to key : Relational!Column ( name <− ne.name )
}
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
Mutation testing for ATL
rule Class2Table {
from c : Class!Class (not c.isAbstract)
to out : Relational!Table … }
CFCP
:Class
isAbstract=true
name=‘Person’
original transformation mutant transformation
Min
Mout M’out

rule Class2Table {
from c : Class!Class (not c.isAbstract
and c.name=‘’)
to out : Relational!Table … }
:Class
isAbstract=false
name=‘Female’
:supers
:Table
name=‘Female’
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 12 / 30
Mutation Operators
for
ATL
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 13 / 30
Mutation operators for ATL
Syntactic operators
Create-update-delete operations on language elements
Troya et al. [1]: 18 operators for main elements of ATL meta-model
Concept Operator
Matched rule addition
deletion
name change
In and out pattern element addition
deletion
class change
name change
Filter addition
deletion
condition change
Binding addition
deletion
value change
feature change
1
Troya et al., Towards systematic mutations for and with ATL model transformations, ICST Workshops, 2015, pp. 1-10
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 14 / 30
Mutation operators for ATL
Semantic operators
Operations mimic faults a developer may incur, based on authors’
experience not on empirical evidence
Mottu et al. [1,2]: 10 operators which are language-independent
Navigation operators
Relation to the same class change (RSCC) Replaces navigation by another to the same class
Relation to another class change (ROCC) Replaces navigation by another to a different class
Relation sequence modification with deletion (RSMD) Removes last step of a navigation sequence
Relation sequence modification with addition (RSMA) Adds navigation step in a navigation sequence
Filter operators
Collection filtering change with perturbation (CFCP) Modifies filter, e.g., acting on property or type of class
Collection filtering change with deletion (CFCD) Deletes filter
Collection filtering change with addition (CFCA) Adds filter, e.g., returning an arbitrary element
Creation operators
Class compatible creation replacement (CCCR) Replaces type of created object by a compatible one
Classes association creation deletion (CACD) Deletes creation of association
Classes association creation addition (CACA) Adds relation between two target objects
1
Mottu et al., Mutation analysis testing for model transformations, ECMDA-FA, LNCS 4066, Springer, 2006, pp. 376-390
2
Aranega et al., Towards an automation of the mutation analysis dedicated to model transformations, STVR 25(5-7), 2014
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 15 / 30
Mutation operators for ATL
Typing operators
Operators introduce typing errors or force runtime errors
S´anchez et al. [1]: 27 operators
used to test a static analyzer for ATL
coverage of ATL mm + operators for programming languages
Type Targets
Creation binding
source/target pattern element
rule inheritance relation
Deletion rule, helper, binding
source/target pattern element
rule filter, rule inheritance relation ..............
Type modification type of source/target pattern element
helper context type, helper return type
type of variable, collection or parameter ..............
Feature name modification navigation expression, target of binding
Operation name modification predefined operator (e.g., and) or operation (e.g., size)
collection operation (e.g., includes), iterator (e.g., exists, collect)
operation/helper invocation
1
S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 16 / 30
Mutation operators for ATL
Operators based on errors made in practice (zoo)
Operators emulate errors made by competent developers
Zoo set (new!!!): 7 operators emulating the 5 most frequent typing
errors in the ATL zoo [1]
Error Frequency Operator
No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF)
Invalid actual parameter type 11.9% Replace helper call parameter (RHCP)
Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC)
Add navigation after optional feature (ANAOF)
Feature found in subtype 3.75% Replace feature access by subtype feature (RSF)
Binding possibly unresolved 3.7% Restrict rule filter (RRF)
Delete rule (DR)
1
S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
Mutation operators for ATL
Operators based on errors made in practice (zoo)
Operators emulate errors made by competent developers
Zoo set (new!!!): 7 operators emulating the 5 most frequent typing
errors in the ATL zoo [1]
Error Frequency Operator
No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF)
Invalid actual parameter type 11.9% Replace helper call parameter (RHCP)
Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC)
Add navigation after optional feature (ANAOF)
Feature found in subtype 3.75% Replace feature access by subtype feature (RSF)
Binding possibly unresolved 3.7% Restrict rule filter (RRF)
Delete rule (DR)
1
S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
Mutation operators for ATL
Operators based on errors made in practice (zoo)
Operators emulate errors made by competent developers
Zoo set (new!!!): 7 operators emulating the 5 most frequent typing
errors in the ATL zoo [1]
Error Frequency Operator
No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF)
Invalid actual parameter type 11.9% Replace helper call parameter (RHCP)
Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC)
Add navigation after optional feature (ANAOF)
Feature found in subtype 3.75% Replace feature access by subtype feature (RSF)
Binding possibly unresolved 3.7% Restrict rule filter (RRF)
Delete rule (DR)
1
S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
Mutation operators for ATL
Operators based on errors made in practice (zoo)
Operators emulate errors made by competent developers
Zoo set (new!!!): 7 operators emulating the 5 most frequent typing
errors in the ATL zoo [1]
Error Frequency Operator
No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF)
Invalid actual parameter type 11.9% Replace helper call parameter (RHCP)
Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC)
Add navigation after optional feature (ANAOF)
Feature found in subtype 3.75% Replace feature access by subtype feature (RSF)
Binding possibly unresolved 3.7% Restrict rule filter (RRF)
Delete rule (DR)
1
S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
Mutation operators for ATL
Operators based on errors made in practice (zoo)
Operators emulate errors made by competent developers
Zoo set (new!!!): 7 operators emulating the 5 most frequent typing
errors in the ATL zoo [1]
Error Frequency Operator
No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF)
Invalid actual parameter type 11.9% Replace helper call parameter (RHCP)
Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC)
Add navigation after optional feature (ANAOF)
Feature found in subtype 3.75% Replace feature access by subtype feature (RSF)
Binding possibly unresolved 3.7% Restrict rule filter (RRF)
Delete rule (DR)
1
S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
Mutation operators for ATL
Operators based on errors made in practice (zoo)
Operators emulate errors made by competent developers
Zoo set (new!!!): 7 operators emulating the 5 most frequent typing
errors in the ATL zoo [1]
Error Frequency Operator
No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF)
Invalid actual parameter type 11.9% Replace helper call parameter (RHCP)
Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC)
Add navigation after optional feature (ANAOF)
Feature found in subtype 3.75% Replace feature access by subtype feature (RSF)
Binding possibly unresolved 3.7% Restrict rule filter (RRF)
Delete rule (DR)
1
S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
Tool Support
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 18 / 30
Tool support
Java framework for mutation testing of ATL:
https://github.com/jdelara/MDETesting
Implementation of all presented mutation operators (extensible)
Operators can use transformation typing info (anATLyzer)
Generator of test models (random, mm coverage, path coverage)
Generator of mutant-killer models (explained later)
DifferentialTester
MutationRegistry Mutation
ModelGenerator
Path
Coverage
MM
Coverage Random
RSCC RSF
> 50 operators
…
mutations
*
SemanticTyping Syntactic Zoo
MutantGenerator
1
1
ATL Transformation
Mutant
KillerModel
Generator
1 mutant provider
original
1
TestDriver
0..1
1 executes
uses
Type
Information
has
EMF random
instantiator
USE Validator
model finder
AnATLyzer
static analyzer
1
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 19 / 30
Efficacy of
Operators and
Test Model Generation Techniques
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 20 / 30
Evaluation of mutation operators
Experiment design
6 syntactically correct transformations from the ATL zoo
For each transformation:
create test suite with models generated by our three techniques
(random, meta-model coverage, path coverage)
create transformation mutants
compute mutation score
Overall, >32 000 mutants, >1 million executions
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 21 / 30
Evaluation of mutation operators
Applicability of operators
61% operators were applicable to all transformations
4 operators with poor applicability (i.e., frequently useless):
[typ] deletion of parent rule (1 application)
[typ] modification of type of variable (1 application)
[zoo] deletion of enclosing conditional (1 application)
[syn] deletion of input pattern element (0 applications)
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 22 / 30
Evaluation of mutation operators
Resilience and stubbornness of mutants
overall, 88% mutants were killed
most operators produced stubborn mutants (killed by few models)
Id Type Operator Mutants %Killed mutants %Killer models
0 syn In pattern element deletion 0 - -
1 sem Classes association creation addition (CACA) 14 100.00 17.87
2 zoo Replace feature access by subtype feature 48 100.00 3.97
3 typ Parent rule deletion 21 100.00 3.72
4 typ Variable modification 48 100.00 2.08
5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94
........
18 typ,syn In pattern element creation 3818 100.00 0.03
........
21 typ,syn Remove binding 724 99.45 0.13
........
24 zoo Remove binding of compulsory feature 260 99.23 0.36
........
52 typ Helper deletion 780 89.87 0.12
53 typ Parameter deletion 513 89.47 0.15
54 typ Parameter type modification 570 89.47 0.13
55 zoo Add navigation after optional feature 44 83.33 1.04
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
Evaluation of mutation operators
Resilience and stubbornness of mutants
operators 1 to 18 only produced trivial mutants (always killed)
Id Type Operator Mutants %Killed mutants %Killer models
0 syn In pattern element deletion 0 - -
1 sem Classes association creation addition (CACA) 14 100.00 17.87
2 zoo Replace feature access by subtype feature 48 100.00 3.97
3 typ Parent rule deletion 21 100.00 3.72
4 typ Variable modification 48 100.00 2.08
5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94
........
18 typ,syn In pattern element creation 3818 100.00 0.03
........
21 typ,syn Remove binding 724 99.45 0.13
........
24 zoo Remove binding of compulsory feature 260 99.23 0.36
........
52 typ Helper deletion 780 89.87 0.12
53 typ Parameter deletion 513 89.47 0.15
54 typ Parameter type modification 570 89.47 0.13
55 zoo Add navigation after optional feature 44 83.33 1.04
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
Evaluation of mutation operators
Resilience and stubbornness of mutants
operators 52 to 55 produced the hardest-to-kill mutants
mutants of 52–54 were among the stubbornnest
mutants of 55 were crash-prone and not so sttuborn
Id Type Operator Mutants %Killed mutants %Killer models
0 syn In pattern element deletion 0 - -
1 sem Classes association creation addition (CACA) 14 100.00 17.87
2 zoo Replace feature access by subtype feature 48 100.00 3.97
3 typ Parent rule deletion 21 100.00 3.72
4 typ Variable modification 48 100.00 2.08
5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94
........
18 typ,syn In pattern element creation 3818 100.00 0.03
........
21 typ,syn Remove binding 724 99.45 0.13
........
24 zoo Remove binding of compulsory feature 260 99.23 0.36
........
52 typ Helper deletion 780 89.87 0.12
53 typ Parameter deletion 513 89.47 0.15
54 typ Parameter type modification 570 89.47 0.13
55 zoo Add navigation after optional feature 44 83.33 1.04
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
Evaluation of mutation operators
Resilience and stubbornness of mutants
operators 21 & 24 had similar resilience, but 24 created fewer mutants
similarly, matched rule deletion preferrable to rule deletion
Id Type Operator Mutants %Killed mutants %Killer models
0 syn In pattern element deletion 0 - -
1 sem Classes association creation addition (CACA) 14 100.00 17.87
2 zoo Replace feature access by subtype feature 48 100.00 3.97
3 typ Parent rule deletion 21 100.00 3.72
4 typ Variable modification 48 100.00 2.08
5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94
........
18 typ,syn In pattern element creation 3818 100.00 0.03
........
21 typ,syn Remove binding 724 99.45 0.13
........
24 zoo Remove binding of compulsory feature 260 99.23 0.36
........
52 typ Helper deletion 780 89.87 0.12
53 typ Parameter deletion 513 89.47 0.15
54 typ Parameter type modification 570 89.47 0.13
55 zoo Add navigation after optional feature 44 83.33 1.04
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
Evaluation of mutation operators
Resilience and stubbornness of mutants
no operator set was more efficient than the others
zoo operators: 1 hard-to-kill, 3 trivial, 3 intermediate
Id Type Operator Mutants %Killed mutants %Killer models
0 syn In pattern element deletion 0 - -
1 sem Classes association creation addition (CACA) 14 100.00 17.87
2 zoo Replace feature access by subtype feature 48 100.00 3.97
3 typ Parent rule deletion 21 100.00 3.72
4 typ Variable modification 48 100.00 2.08
5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94
........
18 typ,syn In pattern element creation 3818 100.00 0.03
........
21 typ,syn Remove binding 724 99.45 0.13
........
24 zoo Remove binding of compulsory feature 260 99.23 0.36
........
52 typ Helper deletion 780 89.87 0.12
53 typ Parameter deletion 513 89.47 0.15
54 typ Parameter type modification 570 89.47 0.13
55 zoo Add navigation after optional feature 44 83.33 1.04
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
Evaluation of test model generation techniques
Mutation score of test suites generated by:
random instantiation (50 models with 100 objects)
coverage of input meta-model
coverage of transformation execution path
Meta-model Transformation path Random
#M. typ sem syn zoo #M. typ sem syn zoo #M. typ sem syn zoo
t1 62 69.98 80.73 100.00 97.14 27 77.53 75.23 100.00 97.14 50 67.15 58.33 59.86 97.14
t2 200 87.44 31.68 45.54 30.33 18 82.47 71.66 89.31 95.08 50 65.64 56.71 48.36 23.58
t3 50 81.21 81.44 84.50 97.04 1 84.85 87.37 90.56 99.26 50 64.18 81.05 69.01 95.56
t4 50 98.71 68.52 86.17 100.00 92 98.14 98.60 96.33 100.00 50 99.22 98.33 95.74 100.00
t5 710 73.48 82.05 73.37 92.16 24 76.83 84.62 81.41 92.16 50 15.67 65.81 22.22 78.00
t6 26 75.91 72.84 60.96 87.88 6 82.70 70.37 60.56 87.88 50 21.60 19.28 23.51 45.45
Transformation path is the best option
produced the highest-quality test suite more often
produced the smallest test suites (less testing time)
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 24 / 30
Synthesis
of
Mutant-Killer Models
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 25 / 30
Synthesis of mutant-killer models
Method (intuition)
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = -1 then true
else self.upperBound > 1 endif;
false Mutation
live mutant
1) AST node of mutated code
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
Synthesis of mutant-killer models
Method (intuition)
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = -1 then true
else self.upperBound > 1 endif;
false Mutation
live mutant
MVDataType
Attribute2Column
Class2Table
multiValued
control flow graph
upperBound = -1 / then
true false
Helper call
IF
Matched rule
Mutation
Matched rule
2) execution paths from matched rules to mutation
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
Synthesis of mutant-killer models
Method (intuition)
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = -1 then true
else self.upperBound > 1 endif;
false Mutation
live mutant
Class.allInstances()-> -- rule input
select(c | not c.isAbstract)-> -- rule filter
exists(c | c.att->exists(e |
not e.upperBound = -1)) -- inlining of helper
or
Attribute.allInstances()->
exists(a | a.upperBound = -1)
OCL path condition
MVDataType
Attribute2Column
Class2Table
multiValued
control flow graph
upperBound = -1 / then
true false
Helper call
IF
Matched rule
Mutation
Matched rule
3) requirements for a test model to reach the mutated code
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
Synthesis of mutant-killer models
Method (intuition)
model finding
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = -1 then true
else self.upperBound > 1 endif;
false Mutation
live mutant
Class.allInstances()-> -- rule input
select(c | not c.isAbstract)-> -- rule filter
exists(c | c.att->exists(e |
not e.upperBound = -1)) -- inlining of helper
or
Attribute.allInstances()->
exists(a | a.upperBound = -1)
OCL path condition
: Class
isAbstract = false
: Attribute
upperBound = -1
att
input test model
MVDataType
Attribute2Column
Class2Table
multiValued
control flow graph
upperBound = -1 / then
true false
Helper call
IF
Matched rule
Mutation
Matched rule
4) synthesis of input test model by model finding
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
Synthesis of mutant-killer models
Method (intuition)
model finding
helper context Class!Attribute def: multiValued : Boolean =
if self.upperBound = -1 then true
else self.upperBound > 1 endif;
false Mutation
live mutant
Class.allInstances()-> -- rule input
select(c | not c.isAbstract)-> -- rule filter
exists(c | c.att->exists(e |
not e.upperBound = -1)) -- inlining of helper
or
Attribute.allInstances()->
exists(a | a.upperBound = -1)
OCL path condition
: Class
isAbstract = false
: Attribute
upperBound = -1
att
input test model
MVDataType
Attribute2Column
Class2Table
multiValued
control flow graph
upperBound = -1 / then
true false
Helper call
IF
Matched rule
Mutation
Matched rule
However, reachability is necessary but not sufficient...
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
Synthesis of mutant-killer models
Evaluation of efficacy
For each mutant:
generate a killer test model
execute mutant and original transformation with the test model
compare the results
typ sem syn zoo
Mutants %Killed Mutants %Killed Mutants %Killed Mutants %Killed
t1 266 93.94 58 96.55 187 87.57 15 100.00
t2 2200 97.14 550 83.82 4045 97.11 60 81.67
t3 151 93.10 32 100.00 175 94.08 21 95.24
t4 3161 82.76 649 71.19 5993 78.66 65 73.85
t5 382 92.25 75 94.67 363 86.76 41 92.68
t6 153 59.48 42 54.76 143 58.04 16 43.75
Overall, 85% mutants killed
By cases, killed mutants >90% in 12/24 (in green)
Altogether, reasonable good results
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 27 / 30
Wrap-up
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 28 / 30
Wrap-up
Today’s presentation
Analyse some steps in mutation testing for ATL
mutation operators
test model generation techniques
synthesis of mutant-killer models
to make it more effective
(and ATL transformations less buggy)
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 29 / 30
Wrap-up
Today’s presentation
Analyse some steps in mutation testing for ATL
mutation operators
test model generation techniques
synthesis of mutant-killer models
to make it more effective
(and ATL transformations less buggy)
Future plans
Replica of evaluation with partial oracles
Method to detect equivalent mutants for ATL
Improve synthesis of mutant-killer models
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 29 / 30
Towards effective mutation testing for ATL
Esther Guerra, Juan de Lara
Universidad Aut´onoma de Madrid (Spain)
Jes´us S´anchez Cuadrado
Universidad de Murcia (Spain)
esther.guerra@uam.es
Questions?
Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 30 / 30

More Related Content

PPTX
Operators in java
DOC
assignment2.doc
PDF
Wodel-Test: A Model-Based Framework for Language-Independent Mutation Testing
PDF
Search-Based Robustness Testing of Data Processing Systems
PDF
SAIConference_PAPER
PDF
A Systematic Approach to Generate Diverse Instantiations for Conceptual Schemas
PDF
Higher Order Mutant Generation to Decrease the Cost of Mutation Testing Sudhi...
PDF
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION
Operators in java
assignment2.doc
Wodel-Test: A Model-Based Framework for Language-Independent Mutation Testing
Search-Based Robustness Testing of Data Processing Systems
SAIConference_PAPER
A Systematic Approach to Generate Diverse Instantiations for Conceptual Schemas
Higher Order Mutant Generation to Decrease the Cost of Mutation Testing Sudhi...
AI-ASSISTED METAMORPHIC TESTING FOR DOMAIN-SPECIFIC MODELLING AND SIMULATION

More from miso_uam (20)

PPT
Software development... for all? (keynote at ICSOFT'2024)
PDF
Model-driven engineering for AR
PDF
Capone.pdf
PDF
MLE_keynote.pdf
PDF
Multi21
PDF
MLMPLs
PDF
Scientific writing
PDF
Facets_UCM
PDF
SLE_MIP08
PDF
Máster en Métodos Formales en Ingeniería Informática
PDF
Analysing-MMPLs
PDF
Facets
PDF
kite
PDF
MTPLs
PDF
Miso-McGill
PDF
Model Transformation Reuse
PDF
Miso
PDF
DSLcomet
PDF
SICOMORO
PDF
ReusingMT
Software development... for all? (keynote at ICSOFT'2024)
Model-driven engineering for AR
Capone.pdf
MLE_keynote.pdf
Multi21
MLMPLs
Scientific writing
Facets_UCM
SLE_MIP08
Máster en Métodos Formales en Ingeniería Informática
Analysing-MMPLs
Facets
kite
MTPLs
Miso-McGill
Model Transformation Reuse
Miso
DSLcomet
SICOMORO
ReusingMT
Ad

Recently uploaded (20)

PDF
Workplace Software and Skills - OpenStax
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PPTX
ROI from Efficient Content & Campaign Management in the Digital Media Industry
PDF
What Makes a Great Data Visualization Consulting Service.pdf
PDF
Streamlining Project Management in Microsoft Project, Planner, and Teams with...
PPTX
Human Computer Interaction lecture Chapter 2.pptx
PDF
AI-Powered Fuzz Testing: The Future of QA
PDF
IT Consulting Services to Secure Future Growth
PDF
Crypto Loss And Recovery Guide By Expert Recovery Agency.
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PPTX
Viber For Windows 25.7.1 Crack + Serial Keygen
PPTX
Bandicam Screen Recorder 8.2.1 Build 2529 Crack
PPTX
Lecture 5 Software Requirement Engineering
PDF
Cloud Native Aachen Meetup - Aug 21, 2025
PPTX
DevOpsDays Halifax 2025 - Building 10x Organizations Using Modern Productivit...
PPTX
Odoo ERP for Injection Molding Industry – Optimize Production & Reduce Scrap
PPTX
Human-Computer Interaction for Lecture 2
PPTX
Folder Lock 10.1.9 Crack With Serial Key
PDF
infoteam HELLAS company profile 2025 presentation
Workplace Software and Skills - OpenStax
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
ROI from Efficient Content & Campaign Management in the Digital Media Industry
What Makes a Great Data Visualization Consulting Service.pdf
Streamlining Project Management in Microsoft Project, Planner, and Teams with...
Human Computer Interaction lecture Chapter 2.pptx
AI-Powered Fuzz Testing: The Future of QA
IT Consulting Services to Secure Future Growth
Crypto Loss And Recovery Guide By Expert Recovery Agency.
Understanding the Need for Systemic Change in Open Source Through Intersectio...
BoxLang Dynamic AWS Lambda - Japan Edition
Viber For Windows 25.7.1 Crack + Serial Keygen
Bandicam Screen Recorder 8.2.1 Build 2529 Crack
Lecture 5 Software Requirement Engineering
Cloud Native Aachen Meetup - Aug 21, 2025
DevOpsDays Halifax 2025 - Building 10x Organizations Using Modern Productivit...
Odoo ERP for Injection Molding Industry – Optimize Production & Reduce Scrap
Human-Computer Interaction for Lecture 2
Folder Lock 10.1.9 Crack With Serial Key
infoteam HELLAS company profile 2025 presentation
Ad

mtATL

  • 1. Towards effective mutation testing for ATL Esther Guerra, Juan de Lara Universidad Aut´onoma de Madrid (Spain) Jes´us S´anchez Cuadrado Universidad de Murcia (Spain) Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 1 / 30 miso.es
  • 2. Introduction Model transformations Importance of correctness of model transformations Testing of transformations helps in detecting errors How do you know if you did enough tests? Mutation testing to the rescue! It permits quantifying the quality of a test suite Based on injecting artificial faults in the program under test If test suite detects the artificial faults, it will likely detect real errors Our focus is on mutation testing for ATL Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 2 / 30
  • 3. Introduction Mutation testing Input ATL transformation to test Test suite made of: input models (manual vs automatic) oracle function (partial vs total) Challenge: Identify the best test input model generation technique good at finding errors few models if possible test cases program under test INPUT 1 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 3 / 30
  • 4. Introduction Mutation testing Mutation operators Mimic errors of competent developers Used to create mutants of the program Operators for ATL exist, but do not mimic real errors Challenge: Design operators based on errors made by ATL developers mutant programs mutation operators test cases 2 program under test INPUT 2 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 4 / 30
  • 5. Introduction Mutation testing Mutation score For each mutant, execute test suite against mutant and original program Compare results if different, the mutant is killed otherwise, it is alive (undetected error) Mutation score = killed mutants / total mutants The higher the score, the better the quality of the test suite mutant programs mutation operators live mutants killed mutants mutation score test cases yes no 3 program under test INPUT mutant test == original test Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 5 / 30
  • 6. Introduction Mutation testing On effectiveness Mutation testing is very expensive (many potential mutants) Careful selection of mutation operators do not produce trivial mutants produce hard-to-kill mutants Challenge: Analyse the effectiveness of operators for ATL, which is unknown mutant programs mutation operators live mutants killed mutants mutation score test cases yes no 3 program under test INPUT mutant test == original test Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 6 / 30
  • 7. Introduction Mutation testing Improving the test suite Add input models that kill live mutants Challenge: Devise a technique to synthesize mutant-killer models for ATL mutant programs mutation operators live mutants killed mutants mutation score additional test cases test cases yes no program under test INPUT mutant test == original test 4 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 7 / 30
  • 8. Contributions Mutation operators for ATL new operators that mimic frequent ATL developer errors evaluation of efficacy of these and other operators Test suite evaluation of efficacy of three test model generation techniques: random, meta-model coverage, transformation coverage novel technique to generate input models that kill live mutants Open-source tool for mutation testing of ATL Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 8 / 30
  • 9. A Brief Tour of ATL Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 9 / 30
  • 10. ATL Atlas Transformation Language Widely used model transformation language Dynamic, testing is needed to avoid runtime errors Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 10 / 30
  • 11. ATL by example create OUT : Relational from IN : Class helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = −1 then true else self.upperBound > 1 endif; rule Class2Table { from c : Class!Class ( not c.isAbstract ) to out : Relational!Table ( name <− c.name, col <− Sequence{key}→union(c.att→select(e | not e.multiValued)), key <− Set{key} ), key : Relational!Column ( name <− ’objectId’ ) } rule MultiValuedDataTypeAttribute2Column { from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued ) to out : Relational!Table ( name <− a.owner.nameOrEmpty + ’ ’ + a.name, col <− Sequence {thisModule.createIdColumn(a.owner), value} ), value : Relational!Column ( name <− a.name ) } lazy rule createIdColumn { from ne : Class!NamedElt to key : Relational!Column ( name <− ne.name ) } Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
  • 12. ATL by example create OUT : Relational from IN : Class // input and output meta−models helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = −1 then true else self.upperBound > 1 endif; rule Class2Table { from c : Class!Class ( not c.isAbstract ) to out : Relational!Table ( name <− c.name, col <− Sequence{key}→union(c.att→select(e | not e.multiValued)), key <− Set{key} ), key : Relational!Column ( name <− ’objectId’ ) } rule MultiValuedDataTypeAttribute2Column { from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued ) to out : Relational!Table ( name <− a.owner.nameOrEmpty + ’ ’ + a.name, col <− Sequence {thisModule.createIdColumn(a.owner), value} ), value : Relational!Column ( name <− a.name ) } lazy rule createIdColumn { from ne : Class!NamedElt to key : Relational!Column ( name <− ne.name ) } Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
  • 13. ATL by example create OUT : Relational from IN : Class helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = −1 then true else self.upperBound > 1 endif; rule Class2Table { // matched rule from c : Class!Class ( not c.isAbstract ) // input pattern with filter to out : Relational!Table ( // output pattern name <− c.name, col <− Sequence{key}→union(c.att→select(e | not e.multiValued)), key <− Set{key} ), key : Relational!Column ( name <− ’objectId’ ) } rule MultiValuedDataTypeAttribute2Column { from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued ) to out : Relational!Table ( name <− a.owner.nameOrEmpty + ’ ’ + a.name, col <− Sequence {thisModule.createIdColumn(a.owner), value} ), value : Relational!Column ( name <− a.name ) } lazy rule createIdColumn { from ne : Class!NamedElt to key : Relational!Column ( name <− ne.name ) } Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
  • 14. ATL by example create OUT : Relational from IN : Class helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = −1 then true else self.upperBound > 1 endif; rule Class2Table { from c : Class!Class ( not c.isAbstract ) to out : Relational!Table ( name <− c.name, // binding col <− Sequence{key}→union(c.att→select(e | not e.multiValued)), // binding key <− Set{key} ), key : Relational!Column ( name <− ’objectId’ ) } rule MultiValuedDataTypeAttribute2Column { from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued ) to out : Relational!Table ( name <− a.owner.nameOrEmpty + ’ ’ + a.name, col <− Sequence {thisModule.createIdColumn(a.owner), value} ), value : Relational!Column ( name <− a.name ) } lazy rule createIdColumn { from ne : Class!NamedElt to key : Relational!Column ( name <− ne.name ) } Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
  • 15. ATL by example create OUT : Relational from IN : Class helper context Class!Attribute def: multiValued : Boolean = // helper, similar to a function if self.upperBound = −1 then true else self.upperBound > 1 endif; rule Class2Table { from c : Class!Class ( not c.isAbstract ) to out : Relational!Table ( name <− c.name, col <− Sequence{key}→union(c.att→select(e | not e.multiValued)), // helper invocation key <− Set{key} ), key : Relational!Column ( name <− ’objectId’ ) } rule MultiValuedDataTypeAttribute2Column { from a : Class!Attribute ( a.type.oclIsKindOf(Class!DataType) and a.multiValued ) to out : Relational!Table ( name <− a.owner.nameOrEmpty + ’ ’ + a.name, col <− Sequence {thisModule.createIdColumn(a.owner), value} ), value : Relational!Column ( name <− a.name ) } lazy rule createIdColumn { from ne : Class!NamedElt to key : Relational!Column ( name <− ne.name ) } Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 11 / 30
  • 16. Mutation testing for ATL rule Class2Table { from c : Class!Class (not c.isAbstract) to out : Relational!Table … } CFCP :Class isAbstract=true name=‘Person’ original transformation mutant transformation Min Mout M’out  rule Class2Table { from c : Class!Class (not c.isAbstract and c.name=‘’) to out : Relational!Table … } :Class isAbstract=false name=‘Female’ :supers :Table name=‘Female’ Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 12 / 30
  • 17. Mutation Operators for ATL Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 13 / 30
  • 18. Mutation operators for ATL Syntactic operators Create-update-delete operations on language elements Troya et al. [1]: 18 operators for main elements of ATL meta-model Concept Operator Matched rule addition deletion name change In and out pattern element addition deletion class change name change Filter addition deletion condition change Binding addition deletion value change feature change 1 Troya et al., Towards systematic mutations for and with ATL model transformations, ICST Workshops, 2015, pp. 1-10 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 14 / 30
  • 19. Mutation operators for ATL Semantic operators Operations mimic faults a developer may incur, based on authors’ experience not on empirical evidence Mottu et al. [1,2]: 10 operators which are language-independent Navigation operators Relation to the same class change (RSCC) Replaces navigation by another to the same class Relation to another class change (ROCC) Replaces navigation by another to a different class Relation sequence modification with deletion (RSMD) Removes last step of a navigation sequence Relation sequence modification with addition (RSMA) Adds navigation step in a navigation sequence Filter operators Collection filtering change with perturbation (CFCP) Modifies filter, e.g., acting on property or type of class Collection filtering change with deletion (CFCD) Deletes filter Collection filtering change with addition (CFCA) Adds filter, e.g., returning an arbitrary element Creation operators Class compatible creation replacement (CCCR) Replaces type of created object by a compatible one Classes association creation deletion (CACD) Deletes creation of association Classes association creation addition (CACA) Adds relation between two target objects 1 Mottu et al., Mutation analysis testing for model transformations, ECMDA-FA, LNCS 4066, Springer, 2006, pp. 376-390 2 Aranega et al., Towards an automation of the mutation analysis dedicated to model transformations, STVR 25(5-7), 2014 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 15 / 30
  • 20. Mutation operators for ATL Typing operators Operators introduce typing errors or force runtime errors S´anchez et al. [1]: 27 operators used to test a static analyzer for ATL coverage of ATL mm + operators for programming languages Type Targets Creation binding source/target pattern element rule inheritance relation Deletion rule, helper, binding source/target pattern element rule filter, rule inheritance relation .............. Type modification type of source/target pattern element helper context type, helper return type type of variable, collection or parameter .............. Feature name modification navigation expression, target of binding Operation name modification predefined operator (e.g., and) or operation (e.g., size) collection operation (e.g., includes), iterator (e.g., exists, collect) operation/helper invocation 1 S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 16 / 30
  • 21. Mutation operators for ATL Operators based on errors made in practice (zoo) Operators emulate errors made by competent developers Zoo set (new!!!): 7 operators emulating the 5 most frequent typing errors in the ATL zoo [1] Error Frequency Operator No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF) Invalid actual parameter type 11.9% Replace helper call parameter (RHCP) Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC) Add navigation after optional feature (ANAOF) Feature found in subtype 3.75% Replace feature access by subtype feature (RSF) Binding possibly unresolved 3.7% Restrict rule filter (RRF) Delete rule (DR) 1 S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
  • 22. Mutation operators for ATL Operators based on errors made in practice (zoo) Operators emulate errors made by competent developers Zoo set (new!!!): 7 operators emulating the 5 most frequent typing errors in the ATL zoo [1] Error Frequency Operator No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF) Invalid actual parameter type 11.9% Replace helper call parameter (RHCP) Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC) Add navigation after optional feature (ANAOF) Feature found in subtype 3.75% Replace feature access by subtype feature (RSF) Binding possibly unresolved 3.7% Restrict rule filter (RRF) Delete rule (DR) 1 S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
  • 23. Mutation operators for ATL Operators based on errors made in practice (zoo) Operators emulate errors made by competent developers Zoo set (new!!!): 7 operators emulating the 5 most frequent typing errors in the ATL zoo [1] Error Frequency Operator No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF) Invalid actual parameter type 11.9% Replace helper call parameter (RHCP) Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC) Add navigation after optional feature (ANAOF) Feature found in subtype 3.75% Replace feature access by subtype feature (RSF) Binding possibly unresolved 3.7% Restrict rule filter (RRF) Delete rule (DR) 1 S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
  • 24. Mutation operators for ATL Operators based on errors made in practice (zoo) Operators emulate errors made by competent developers Zoo set (new!!!): 7 operators emulating the 5 most frequent typing errors in the ATL zoo [1] Error Frequency Operator No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF) Invalid actual parameter type 11.9% Replace helper call parameter (RHCP) Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC) Add navigation after optional feature (ANAOF) Feature found in subtype 3.75% Replace feature access by subtype feature (RSF) Binding possibly unresolved 3.7% Restrict rule filter (RRF) Delete rule (DR) 1 S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
  • 25. Mutation operators for ATL Operators based on errors made in practice (zoo) Operators emulate errors made by competent developers Zoo set (new!!!): 7 operators emulating the 5 most frequent typing errors in the ATL zoo [1] Error Frequency Operator No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF) Invalid actual parameter type 11.9% Replace helper call parameter (RHCP) Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC) Add navigation after optional feature (ANAOF) Feature found in subtype 3.75% Replace feature access by subtype feature (RSF) Binding possibly unresolved 3.7% Restrict rule filter (RRF) Delete rule (DR) 1 S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
  • 26. Mutation operators for ATL Operators based on errors made in practice (zoo) Operators emulate errors made by competent developers Zoo set (new!!!): 7 operators emulating the 5 most frequent typing errors in the ATL zoo [1] Error Frequency Operator No binding for compulsory target feature 48.8% Remove binding of compulsory feature (RBCF) Invalid actual parameter type 11.9% Replace helper call parameter (RHCP) Feature access over possibly undefined receptor 11.22% Remove enclosing conditional (REC) Add navigation after optional feature (ANAOF) Feature found in subtype 3.75% Replace feature access by subtype feature (RSF) Binding possibly unresolved 3.7% Restrict rule filter (RRF) Delete rule (DR) 1 S´anchez et al., Static analysis of model transformations, IEEE TSE 43(9), 2017, pp. 868-897 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 17 / 30
  • 27. Tool Support Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 18 / 30
  • 28. Tool support Java framework for mutation testing of ATL: https://github.com/jdelara/MDETesting Implementation of all presented mutation operators (extensible) Operators can use transformation typing info (anATLyzer) Generator of test models (random, mm coverage, path coverage) Generator of mutant-killer models (explained later) DifferentialTester MutationRegistry Mutation ModelGenerator Path Coverage MM Coverage Random RSCC RSF > 50 operators … mutations * SemanticTyping Syntactic Zoo MutantGenerator 1 1 ATL Transformation Mutant KillerModel Generator 1 mutant provider original 1 TestDriver 0..1 1 executes uses Type Information has EMF random instantiator USE Validator model finder AnATLyzer static analyzer 1 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 19 / 30
  • 29. Efficacy of Operators and Test Model Generation Techniques Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 20 / 30
  • 30. Evaluation of mutation operators Experiment design 6 syntactically correct transformations from the ATL zoo For each transformation: create test suite with models generated by our three techniques (random, meta-model coverage, path coverage) create transformation mutants compute mutation score Overall, >32 000 mutants, >1 million executions Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 21 / 30
  • 31. Evaluation of mutation operators Applicability of operators 61% operators were applicable to all transformations 4 operators with poor applicability (i.e., frequently useless): [typ] deletion of parent rule (1 application) [typ] modification of type of variable (1 application) [zoo] deletion of enclosing conditional (1 application) [syn] deletion of input pattern element (0 applications) Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 22 / 30
  • 32. Evaluation of mutation operators Resilience and stubbornness of mutants overall, 88% mutants were killed most operators produced stubborn mutants (killed by few models) Id Type Operator Mutants %Killed mutants %Killer models 0 syn In pattern element deletion 0 - - 1 sem Classes association creation addition (CACA) 14 100.00 17.87 2 zoo Replace feature access by subtype feature 48 100.00 3.97 3 typ Parent rule deletion 21 100.00 3.72 4 typ Variable modification 48 100.00 2.08 5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94 ........ 18 typ,syn In pattern element creation 3818 100.00 0.03 ........ 21 typ,syn Remove binding 724 99.45 0.13 ........ 24 zoo Remove binding of compulsory feature 260 99.23 0.36 ........ 52 typ Helper deletion 780 89.87 0.12 53 typ Parameter deletion 513 89.47 0.15 54 typ Parameter type modification 570 89.47 0.13 55 zoo Add navigation after optional feature 44 83.33 1.04 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
  • 33. Evaluation of mutation operators Resilience and stubbornness of mutants operators 1 to 18 only produced trivial mutants (always killed) Id Type Operator Mutants %Killed mutants %Killer models 0 syn In pattern element deletion 0 - - 1 sem Classes association creation addition (CACA) 14 100.00 17.87 2 zoo Replace feature access by subtype feature 48 100.00 3.97 3 typ Parent rule deletion 21 100.00 3.72 4 typ Variable modification 48 100.00 2.08 5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94 ........ 18 typ,syn In pattern element creation 3818 100.00 0.03 ........ 21 typ,syn Remove binding 724 99.45 0.13 ........ 24 zoo Remove binding of compulsory feature 260 99.23 0.36 ........ 52 typ Helper deletion 780 89.87 0.12 53 typ Parameter deletion 513 89.47 0.15 54 typ Parameter type modification 570 89.47 0.13 55 zoo Add navigation after optional feature 44 83.33 1.04 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
  • 34. Evaluation of mutation operators Resilience and stubbornness of mutants operators 52 to 55 produced the hardest-to-kill mutants mutants of 52–54 were among the stubbornnest mutants of 55 were crash-prone and not so sttuborn Id Type Operator Mutants %Killed mutants %Killer models 0 syn In pattern element deletion 0 - - 1 sem Classes association creation addition (CACA) 14 100.00 17.87 2 zoo Replace feature access by subtype feature 48 100.00 3.97 3 typ Parent rule deletion 21 100.00 3.72 4 typ Variable modification 48 100.00 2.08 5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94 ........ 18 typ,syn In pattern element creation 3818 100.00 0.03 ........ 21 typ,syn Remove binding 724 99.45 0.13 ........ 24 zoo Remove binding of compulsory feature 260 99.23 0.36 ........ 52 typ Helper deletion 780 89.87 0.12 53 typ Parameter deletion 513 89.47 0.15 54 typ Parameter type modification 570 89.47 0.13 55 zoo Add navigation after optional feature 44 83.33 1.04 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
  • 35. Evaluation of mutation operators Resilience and stubbornness of mutants operators 21 & 24 had similar resilience, but 24 created fewer mutants similarly, matched rule deletion preferrable to rule deletion Id Type Operator Mutants %Killed mutants %Killer models 0 syn In pattern element deletion 0 - - 1 sem Classes association creation addition (CACA) 14 100.00 17.87 2 zoo Replace feature access by subtype feature 48 100.00 3.97 3 typ Parent rule deletion 21 100.00 3.72 4 typ Variable modification 48 100.00 2.08 5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94 ........ 18 typ,syn In pattern element creation 3818 100.00 0.03 ........ 21 typ,syn Remove binding 724 99.45 0.13 ........ 24 zoo Remove binding of compulsory feature 260 99.23 0.36 ........ 52 typ Helper deletion 780 89.87 0.12 53 typ Parameter deletion 513 89.47 0.15 54 typ Parameter type modification 570 89.47 0.13 55 zoo Add navigation after optional feature 44 83.33 1.04 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
  • 36. Evaluation of mutation operators Resilience and stubbornness of mutants no operator set was more efficient than the others zoo operators: 1 hard-to-kill, 3 trivial, 3 intermediate Id Type Operator Mutants %Killed mutants %Killer models 0 syn In pattern element deletion 0 - - 1 sem Classes association creation addition (CACA) 14 100.00 17.87 2 zoo Replace feature access by subtype feature 48 100.00 3.97 3 typ Parent rule deletion 21 100.00 3.72 4 typ Variable modification 48 100.00 2.08 5 sem Relation sequence modification with deletion (RSMD) 72 100.00 1.94 ........ 18 typ,syn In pattern element creation 3818 100.00 0.03 ........ 21 typ,syn Remove binding 724 99.45 0.13 ........ 24 zoo Remove binding of compulsory feature 260 99.23 0.36 ........ 52 typ Helper deletion 780 89.87 0.12 53 typ Parameter deletion 513 89.47 0.15 54 typ Parameter type modification 570 89.47 0.13 55 zoo Add navigation after optional feature 44 83.33 1.04 Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 23 / 30
  • 37. Evaluation of test model generation techniques Mutation score of test suites generated by: random instantiation (50 models with 100 objects) coverage of input meta-model coverage of transformation execution path Meta-model Transformation path Random #M. typ sem syn zoo #M. typ sem syn zoo #M. typ sem syn zoo t1 62 69.98 80.73 100.00 97.14 27 77.53 75.23 100.00 97.14 50 67.15 58.33 59.86 97.14 t2 200 87.44 31.68 45.54 30.33 18 82.47 71.66 89.31 95.08 50 65.64 56.71 48.36 23.58 t3 50 81.21 81.44 84.50 97.04 1 84.85 87.37 90.56 99.26 50 64.18 81.05 69.01 95.56 t4 50 98.71 68.52 86.17 100.00 92 98.14 98.60 96.33 100.00 50 99.22 98.33 95.74 100.00 t5 710 73.48 82.05 73.37 92.16 24 76.83 84.62 81.41 92.16 50 15.67 65.81 22.22 78.00 t6 26 75.91 72.84 60.96 87.88 6 82.70 70.37 60.56 87.88 50 21.60 19.28 23.51 45.45 Transformation path is the best option produced the highest-quality test suite more often produced the smallest test suites (less testing time) Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 24 / 30
  • 38. Synthesis of Mutant-Killer Models Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 25 / 30
  • 39. Synthesis of mutant-killer models Method (intuition) helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = -1 then true else self.upperBound > 1 endif; false Mutation live mutant 1) AST node of mutated code Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
  • 40. Synthesis of mutant-killer models Method (intuition) helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = -1 then true else self.upperBound > 1 endif; false Mutation live mutant MVDataType Attribute2Column Class2Table multiValued control flow graph upperBound = -1 / then true false Helper call IF Matched rule Mutation Matched rule 2) execution paths from matched rules to mutation Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
  • 41. Synthesis of mutant-killer models Method (intuition) helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = -1 then true else self.upperBound > 1 endif; false Mutation live mutant Class.allInstances()-> -- rule input select(c | not c.isAbstract)-> -- rule filter exists(c | c.att->exists(e | not e.upperBound = -1)) -- inlining of helper or Attribute.allInstances()-> exists(a | a.upperBound = -1) OCL path condition MVDataType Attribute2Column Class2Table multiValued control flow graph upperBound = -1 / then true false Helper call IF Matched rule Mutation Matched rule 3) requirements for a test model to reach the mutated code Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
  • 42. Synthesis of mutant-killer models Method (intuition) model finding helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = -1 then true else self.upperBound > 1 endif; false Mutation live mutant Class.allInstances()-> -- rule input select(c | not c.isAbstract)-> -- rule filter exists(c | c.att->exists(e | not e.upperBound = -1)) -- inlining of helper or Attribute.allInstances()-> exists(a | a.upperBound = -1) OCL path condition : Class isAbstract = false : Attribute upperBound = -1 att input test model MVDataType Attribute2Column Class2Table multiValued control flow graph upperBound = -1 / then true false Helper call IF Matched rule Mutation Matched rule 4) synthesis of input test model by model finding Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
  • 43. Synthesis of mutant-killer models Method (intuition) model finding helper context Class!Attribute def: multiValued : Boolean = if self.upperBound = -1 then true else self.upperBound > 1 endif; false Mutation live mutant Class.allInstances()-> -- rule input select(c | not c.isAbstract)-> -- rule filter exists(c | c.att->exists(e | not e.upperBound = -1)) -- inlining of helper or Attribute.allInstances()-> exists(a | a.upperBound = -1) OCL path condition : Class isAbstract = false : Attribute upperBound = -1 att input test model MVDataType Attribute2Column Class2Table multiValued control flow graph upperBound = -1 / then true false Helper call IF Matched rule Mutation Matched rule However, reachability is necessary but not sufficient... Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 26 / 30
  • 44. Synthesis of mutant-killer models Evaluation of efficacy For each mutant: generate a killer test model execute mutant and original transformation with the test model compare the results typ sem syn zoo Mutants %Killed Mutants %Killed Mutants %Killed Mutants %Killed t1 266 93.94 58 96.55 187 87.57 15 100.00 t2 2200 97.14 550 83.82 4045 97.11 60 81.67 t3 151 93.10 32 100.00 175 94.08 21 95.24 t4 3161 82.76 649 71.19 5993 78.66 65 73.85 t5 382 92.25 75 94.67 363 86.76 41 92.68 t6 153 59.48 42 54.76 143 58.04 16 43.75 Overall, 85% mutants killed By cases, killed mutants >90% in 12/24 (in green) Altogether, reasonable good results Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 27 / 30
  • 45. Wrap-up Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 28 / 30
  • 46. Wrap-up Today’s presentation Analyse some steps in mutation testing for ATL mutation operators test model generation techniques synthesis of mutant-killer models to make it more effective (and ATL transformations less buggy) Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 29 / 30
  • 47. Wrap-up Today’s presentation Analyse some steps in mutation testing for ATL mutation operators test model generation techniques synthesis of mutant-killer models to make it more effective (and ATL transformations less buggy) Future plans Replica of evaluation with partial oracles Method to detect equivalent mutants for ATL Improve synthesis of mutant-killer models Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 29 / 30
  • 48. Towards effective mutation testing for ATL Esther Guerra, Juan de Lara Universidad Aut´onoma de Madrid (Spain) Jes´us S´anchez Cuadrado Universidad de Murcia (Spain) [email protected] Questions? Esther Guerra Towards effective mutation testing for ATL MoDELS 2019 30 / 30