Wodel: A DSL for Model Mutation; and Wodel-Edu: its Application to the Automated Generation of Exercises
1. Wodel: A DSL for Model Mutation; and Wodel-Edu:
its Application to the Automated Generation of Exercises
Pablo Gómez-Abajo, Esther Guerra, Juan de Lara
A model mutation is a variation of a seed model by the application
of one or more mutation operators.
Model mutation has many applications:
• Model transformation testing.
• Model-based software testing.
• Software product lines testing.
• Automated generation of exercises.
• Evolutionary algorithms.
…
0
101
0
110
1
010
Seed model
Mutant models
What is a Model Mutation?
Universidad Autónoma de Madrid (Spain)
http://www.miso.es
modelling & software engineering research group
Motivation
Existing frameworks for model mutation:
• are specific for a language (e.g., logic formula).
• or specific for a domain (e.g., testing).
• mutation operators are manually encoded.
We propose the DSL Wodel for model mutation:
• high-level mutation primitives.
• independence from target language and domain.
• compiled into Java code.
• extensible through post-processors.
Wodel
Seed model
...
if (a == true) then
...
...
if (a != true) then
...
Mutant model
Wodel: example
Automaton
name: String
State
Transition
*
name: String
isInitial: boolean
isFinal: boolean
src
tar symbol0..1
states* * transitions
inv1: self.states->one(s | s.isInitial)
inv2: self.states->exists(s | s.isFinal)
inv3: self.alphabet->forAll (a1, a2 |
a1.symbol = a2.symbol
implies a1 = a2)
alphabet
Symbol
symbol: String
generate 3 mutants in "out/" from "evenBinary.fa"
metamodel "http://fa.com"
with commands {
s0 = modify one State where {isFinal = true} with {reverse(isFinal)}
s1 = create State with {isFinal = true}
t0 = create Transition with {src = s0, tar = s1, symbol = one Symbol}
}
seed
models
DSL
meta-
model
postProc
WODEL
engine
editor (Xtext)
code gen (Xtend)
Java code
model
mutants
code completion, validator
WODEL
program
«conforms»
check
generate, compile, execute
mutation
registry
«refers-to»«refers-to»
Tool ArchitectureMutations Registry
• Optional, it is activated through the preferences page
• Useful when generating text options in test exercises
• References to seed models and mutant models
• Optionally, the framework can reduce the registry
(irrelevant mutations)
Registry
def
AppliedMutation
*
Object
Created
Reference
Changed
refs Information
Changed
mutations
*
*
… Attribute
Changed
Composite
Mutation
Source
Reference
Changed
Target
Reference
Changed
Reference
Swap
*
atts
Attribute
Swap
objects
*
Mutation
EObject
object objects
*
{ordered}
Blocks and OCL Constraints
Wodel supports mutation blocks:
• Mutants generation by stages
• A block can take as seed models the mutants
generated in previous blocks
• Folders hierarchy for mutants identification
• Duplicated mutants control with directive repeat=no
OCL Constraints in Wodel Code:
• Applied over the generated mutants, although they
are not in the domain meta-model
postProc
WODEL
engine
WODEL-EDU
DSL eduTest
DSL modelDraw
mutants
model rendering
description
DSL modelText
learning
environment
exercises
description
DSL mutaText
code generator
mutation textual
description
model element
textual description
Wodel-Edu: Architecture
seed
model
WODEL
mutations
model
mutant
model
mutant
WODEL
EDU
model
mutant
seed
model
Is correct? Is correct?
exercise 1 exercise 3
seed
model
WODEL
mutations
model
mutant
model
mutant
WODEL
EDU
model
mutant
seed
model
Which one is correct?
…
model
mutant
seed
model
WODEL
mutations-1
WODEL
EDU
How to correct?
model
mutant-1
model
mutant-1
WODEL
mutations-2
model
mutant-2
mutations-1 (reversed)
mutations-2
(a) Alternative response (b) Multiple diagram choice (c) Multiple emendation choice
exercise 1 exercise 1
Wodel-Edu: Exercises Schema
DSM-TP 2016, Genève, Switzerland, August 22-26 2016
• Wodel-Edu is a post-processing extension to Wodel for the automated
generation of exercises that is domain independent
• Wodel-Edu generates a web application with three kinds of test exercises:
• Alternative response
• Multiple diagram choice
• Multiple emendation choice