Challenges in testing Model Transformations Amr Al-Mallah 1 - - PowerPoint PPT Presentation

challenges in testing model transformations
SMART_READER_LITE
LIVE PREVIEW

Challenges in testing Model Transformations Amr Al-Mallah 1 - - PowerPoint PPT Presentation

Challenges in testing Model Transformations Amr Al-Mallah 1 Outline Overview/Motivation Systematic Software Testing Systematic Software Testing of Model Transformations. Focus : Model differencing 2 Overview Validate models


slide-1
SLIDE 1

Challenges in testing Model Transformations

Amr Al-Mallah

1

slide-2
SLIDE 2

Outline

  • Overview/Motivation
  • Systematic Software Testing
  • Systematic Software Testing of Model

Transformations.

  • Focus : Model differencing

2

slide-3
SLIDE 3

Overview

SUT Testing Code Model Code Model Black box White box XUnit Frameworks ............. Model Based Testing Transf Domain Specific Testing Validate models Multi-view Consistency Transformations

3

slide-4
SLIDE 4

Software Testing

  • Why are we testing ? (Test Objective)
  • What are we testing ? (SUT)
  • How are we testing ? ( Test case selection)
  • Testing oracles
  • Testing process
  • Test automation

4

slide-5
SLIDE 5

Testing Activities

  • 1. Generate Input test cases
  • 2. Test Selection
  • 3. Test Execution
  • 4. Test oracle - verdicts
  • 5. Results visualization for debugging and

reports.

5

slide-6
SLIDE 6

Why are we testing ?

  • Functional testing
  • Non-functional testing:
  • Performance
  • Reliability

6

slide-7
SLIDE 7

SUT

  • Model Transformations artifacts:
  • Textual Specifications
  • Input/Output Meta Models
  • Implementation:
  • Code, Rule-Based .... etc.

7

slide-8
SLIDE 8

Test case selection

  • Black box
  • White box
  • Hybrid

8

slide-9
SLIDE 9

Test Case Selection Black box

  • Applicable to all languages
  • Input meta model coverage
  • Fleury et al:
  • EMOF based MM.
  • Coverage Criteria for Class Attributes,

and Association End Multiplicities.

  • Transformation specifications:
  • Effective Meta Model.

9

slide-10
SLIDE 10

Test Case Selection White box

  • Language and tool specific
  • Kuster et al :
  • Business Process models implemented in

java code.

  • Conceptual Rules coverage => meta

model templates as valid test cases.

  • Constraint coverage

10

slide-11
SLIDE 11

Test Case Selection Hybrid

  • Effective Meta Model:
  • Input Meta model ( back box )
  • Examine the implementation to enhance

meta model (white box) .

  • Sen et al 2008 : Combining knowledge into

Alloy constraints, and generate possible inputs.

11

slide-12
SLIDE 12

Testing Oracles

  • A function which produces a “pass/fail”

verdict on the output of each test case.

  • For each input, a corresponding output

needs to be manually built.

  • Complex, error prone, procedure
  • Some scenarios require further analysis than

syntactic equivalence to produce a verdict.

12

slide-13
SLIDE 13

Testing Oracles

  • Model Comparison
  • Contracts : post conditions on
  • Patterns :
  • Model Fragments
  • Apply to specific inputs

13

slide-14
SLIDE 14

Test Design Automation

  • Generation tools based on the Black box

approaches

  • Mutation tools:
  • Sen et al 2006 : Himesis Mutation
  • perators.

14

slide-15
SLIDE 15

Execution Automation

  • Construction of test case
  • Executing the transformation
  • Producing a verdict on the output
  • Results visualization and reporting

15

slide-16
SLIDE 16

Testing Framework

  • By line et el :
  • Endogenous transformations
  • Assumes a unique identifier for

comparison.

  • Provides visualizations.
  • Integrated in GME, and C-Saw

transformation engine.

16

slide-17
SLIDE 17

TUnit

  • “Model everything” = modeled .
  • Supports model fragments and patterns.
  • Supports time ( based on DEVS )
  • Runs independently.
  • Extends PyUnit.

17

slide-18
SLIDE 18

TUnit

18

slide-19
SLIDE 19

TUnit

  • Semantics equivalence
  • Example :
  • Traffic 2 Petri Nets
  • Compare 2 Petri nets
  • Embed a transformation
  • f PN to Reachability

Graph

19

slide-20
SLIDE 20

Model Comparison

  • Importance to MDE:
  • Model Evolution
  • Version Control
  • Transformation Testing

20

slide-21
SLIDE 21

Model Comparison Activities

  • Identify criteria for matching model
  • elements. ( Unique Identifiers, Matching

attributes, same position... etc)

  • Calculating and represent the difference.

( Algorithm for matching, Edit Scripts )

  • Visualize the differences. ( Coloring,

Difference Models )

21

slide-22
SLIDE 22

Model Comparison

  • Comparison is done on two models.
  • Both models conform to the same meta

model.

22

slide-23
SLIDE 23

Model Comparison

  • Can be applied to:
  • Abstract Syntax (Graph)
  • Concrete Syntax
  • Abstract Syntax of the semantic domain

23

slide-24
SLIDE 24

Model Comparison

Concrete Syntax Comparison

M1 M2 toXML toXML

Root Segment1 Road0 Segment2 Traffic1 Road1 Road2

Root Segment1 Road0 Segment2 Traffic1 Road1

XMLDiff

24

slide-25
SLIDE 25

Model Comparison

  • Models can not always be represented using

trees

  • May have cyclical dependencies.
  • Search algorithm dependent.

25

slide-26
SLIDE 26

Model Comparison

  • Models are represented as Graphs.
  • Graph matching is NP complete.
  • Several workarounds have been proposed.

26

slide-27
SLIDE 27

Model Comparison

Does v2 in M1 Maps to v4 or v4 in M2 ?

27

slide-28
SLIDE 28

Graph Isomorphism Problem

Does M1 Map to M2 ? ( are they isomorphic? )

M1 M2 1 2 3 4 5 6 7 8

28

slide-29
SLIDE 29

Model Comparison Approaches

  • Static Uniques Identifier
  • Each Model Element has A Global Unique

Identity GUID

  • GUID is the matching criteria.
  • A simple sort would serve as the search
  • algorithm. (Fast, Simple)
  • Environment, tool specific and dependent.

29

slide-30
SLIDE 30

Model Comparison Approaches

  • Dynamic Uniques Identifier (“Signatures”)
  • Each Model Element have a function to

generate its uniques identity.

  • The signature function has to be specified

by the user with guaranteed uniqueness.

  • Related to using canonical forms.
  • Language, Structure specific.
  • Examples: XMLDiff.

[RFG+05] 30

slide-31
SLIDE 31

Model Comparison Approaches

  • Language Specific
  • Customized/Optimized for a specific

language or a formalism.

  • Utilizes domain specific knowledge.
  • New Formalism = New full algorithm
  • Examples: UMLDiff, State charts compare.

31

slide-32
SLIDE 32

Model Comparison Approaches

  • Similarity Based
  • Assumes all models are typed attributed

graphs.(or could be transformed to one)

  • Nodes are compared according to their

feature similarities. (structural, or user defined)

  • work with any graph based models (meta

model independent)

  • Examples: SiDiff, DSMDiff .

32

slide-33
SLIDE 33

SiDiff

  • Configurable for any model with graph

structure.

  • Models have to be first transformed into the

internal representation ( Directed, typed graphs ).

  • Users has to provide custom file for

specifying nodes features to use in similarity matching, each with an associated weight.

33

slide-34
SLIDE 34

SiDiff

  • Three phases
  • Hashing phase where hash value for each

element is calculated. ( rep as a vector )

  • Indexing phase, creating S3V trees which

can efficiently find, for a given element, the most similar elements in the other model.

  • Matching phase where exact matches

calculated by looping over each element

  • f one model.

34

slide-35
SLIDE 35

DSMDiff

  • Claims to work on any Domain Specific

Language which where MM is in GME.

  • Uses signature matching, combined with

structural similarities.

  • Supports hierarchical graphs.
  • Does not attempt to find optimal solution.

( Greedy Algorithm )

  • Does not support move

35

slide-36
SLIDE 36

DSMDiff

  • Limitations :
  • Can lead to incorrect solutions.
  • Does not support move operations.

A A'' A' B B'' B' C C M1 M2

36

slide-37
SLIDE 37

Subgraph Isomorphism problem

  • Find all possible
  • ccurrences of

the pattern described in M1 in the host graph M2.

  • Is this related to

Model Comparison ?

M1 M2 1 2 3 6 1 2 4 5

37

slide-38
SLIDE 38

Subgraph Isomorphism problem

  • NP Complete Problem => Use Heuristics
  • Constraints solving problem.
  • Backtracking.
  • HVF by Marc Provost combines prunning

techniques from many sources: VF, VF2 and Ulmann’s Algorithm.

  • Can we re-use these techniques ?

38

slide-39
SLIDE 39

Subgraph Isomorphism problem

  • Multiple Occurrences ? Multiple solutions ? one is
  • ptimal ?
  • Model Comparison:
  • Either of the models can be the subgraph. ( Size )
  • Not all of the elements in subgraph should exist

necessarily in the host graph ( Deleted Nodes ).

  • More related to “Maximum Common Subgraph

Isomorphism” problem.

39

slide-40
SLIDE 40

Maximum Common Induced Subgraph Isomorphism

  • Induced Subgraph of graph G is : “ A set S of

vertices of G, as well as the edges of G with both endpoints in S.”

  • Common Induces Subgraph of graphs G1

and G2 is : ”is a graph G1,2 which is isomorphic to induced subgraphs of G1 and G2.”

40

slide-41
SLIDE 41

Maximum Common Induced Subgraph Isomorphism

M1 M2 1 2 3 6 1 2 4 5 3 7

41

slide-42
SLIDE 42

Maximum Common Induced Subgraph Isomorphism

M1 M2 1 2 3 6 1 2 4 5 3 7

42

slide-43
SLIDE 43

MCIS Algorithms

MCS Algoritms Unconncet ed Conncetd Aproximate Exact Unconncec ted Connected

Uses heuristics to “find” best solutions Uses greedy approximations to “predict” best solution NP- Complete :)

43

slide-44
SLIDE 44

Next ?

  • Look into solutions for comparing chemical

compounds.

  • Attempt to find the most effective

algorithms and heuristics.

  • Implement such algorithm into TUnit

framework.

  • Additionally allow the user to specify

domain specific similarity features to enhance the pruning.

44