<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>TractsTool: Testing Model Transformations based on Contracts</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Loli Burguen˜o</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Manuel Wimmer</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Javier Troya</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Antonio Vallecillo</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Business Informatics Group, Vienna University of Technology</institution>
          ,
          <country country="AT">Austria</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>GISUM/Atenea Research Group. Universidad de Ma ́laga</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Model transformations play an important role in Model-Driven Engineering (MDE), and as their size and complexity grow, there is an increasing need to count on tool support for testing their correctness. In this work, we present TractsTool, a tool for specifying and testing several different kinds of model transformations, e.g., model-to-model, model-to-text, and text-to-model transformations, based on contracts.</p>
      </abstract>
      <kwd-group>
        <kwd>Model transformation</kwd>
        <kwd>contract-based design</kwd>
        <kwd>testing</kwd>
        <kwd>tool support</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>The basis of the Model-Driven Engineering (MDE) paradigm is the usage of models.
They have become key artifacts from which a system may be (semi-)automatically
derived and implemented. Model transformations are the key mechanism of MDE for
manipulating models. Model-to-model (M2M) transformations take as input models
conforming to specific metamodels and transform them into other models conforming
to other (or the same) metamodels. In addition to M2M transformations, model-to-text
(M2T) and text-to-model (T2M) transformations are of major importance. The former
are frequently used to produce code from models, while the latter are typically used for
reverse engineering of legacy systems or injecting artifacts to the MDE technical space.</p>
      <p>
        As the size and complexity of model transformations grow, there is an increasing
need to count on mechanisms and tools for testing their correctness [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. One option is
to validate the behavior of the transformation and its associated properties (termination,
determinism, etc.) using formal methods and their associated tools (cf. e.g., [
        <xref ref-type="bibr" rid="ref2 ref3">2,3</xref>
        ]). The
main drawback is that the whole transformation needs to be dealt with, what makes this
approach inefficient for large models and transformations. An alternative approach [
        <xref ref-type="bibr" rid="ref4 ref5">4,5</xref>
        ]
consists of not validating the transformation for the full input space, but trying to certify
that it works for a selected set of test input models. This may not fully prove correctness,
but it can be very useful for identifying bugs in a cost-effective and light-weight manner.
      </p>
      <p>
        The tool presented in this paper follows the latter approach. We generalize model
transformation contracts [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] for the specification of the properties that need to be
checked for a transformation, and subsequently, apply the ASSL language [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] to
generate input test models. As presented in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], our approach can be applied to M2M as well
as to M2T and T2M transformations.
      </p>
      <p>After this introduction, we have a glance at the foundations of the Tracts approach
in Section 2. In Section 3 we describe how we consider to test M2T and T2M
transformations, whereas in Section 4 we elaborate on how TractsTool is realized. We close the
paper by presenting the conclusions and future work in Section 5.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Tracts at a glance</title>
      <p>
        In Fig. 1 we show the main ingredients of the Tracts approach [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]: a source and
target metamodel, the transformation T under test, and a transformation contract, from
here on and for short called Tracts, which consists of a tract test suite and a set of
tract constraints. A test suite contains a set of models on which constraints are going
to be checked. In the figure, the test suite and its transformation result are shown with
dashed lines. The different Tracts are depicted with thick lines. The user can specify
five different types of constraints: the source and target class diagrams are restricted
by source and target metamodels constraints, and the Tracts additionally impose source
(SRC), target (TRG), and source-target (SRC/TRG) tract constraints. All these
constraints are expressed by means of invariants formulated in the Object Constraint
Language (OCL) [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>For exemplifying how Tracts are defined, we make use of the well-known
Classto-Relational transformation example3. In the following listing, we present for each
constraint type, i.e., source, target, and source-target constraint, one example that the
Class-to-Relational transformation should fulfill. For reasons of brevity, we only present
some very basic constraints. For more complex ones the interested reader is referred to
our project website4.
-- SRC: Classes have to have unique names</p>
      <p>Class . allInstances &gt; unique ( c j c . name )
-- SRC/TRG: For each class, a table has to be produced</p>
      <p>Class . allInstances &gt; forall ( c j Table . allInstances &gt; exists ( t j t . name = c . name ) )
-- TRG: The columns of a table have to have unique names</p>
      <p>
        Table . allInstances &gt; forall ( t j t . columns &gt;unique ( c j c . name ) )
3 http://www.eclipse.org/atl/atlTransformations
4 http://atenea.lcc.uma.es/index.php/Main_Page/Resources/Tracts
Compared to testing M2M transformations, M2T and T2M transformations have not
gained much attention when it comes to testing. In our approach, we adopt current
techniques for testing M2M transformations to the problem of testing T2M and M2T
transformations. The prerequisite of using existing M2M transformation techniques is
to have metamodels for the input and output of the transformations. However, for the
side that is dealing with just text of M2T and T2M transformations, no metamodels are
usually available. Even more problematic, when considering T2M and M2T
transformations, a set of metamodels and T2M parsers may be required as a prerequisite to reach
the MDE technical space. To alleviate the burden from T2M and M2T transformation
engineers, we employ a generic approach that may be used for any transformation task
where text is involved as input or output of the transformations. The main mechanism
we employ is to represent text within a generic metamodel in order to transform M2T
and T2M transformation specification problems into equivalent M2M transformation
specification problems [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
      </p>
      <p>Artifacts involved in M2T and T2M transformations are normally organized in a
hierarchical folder structure. For instance, the output of a M2T transformation may not
be just a single file but several, which should be also arranged in a certain folder
structure forming a repository of artifacts. Fig. 2 shows the metamodel for representing text
artifacts stored in repositories. Meta-class Repository represents the entry point to
the root folder containing folders and files. While folders just contain a name, files have
in addition an extension as well as a content. The content of files is represented by
lines that are sequentially ordered. By having this generic metamodel and an
accompanying generic T2M parser, we are able to inject text artifacts into models and reuse
model-based tools such as the TractsTool. Going back to the Class-to-Relational
transformation example, assume that we are now using a M2T transformation for directly
producing Data Definition Language (DDL) code. The following Tract may be defined
for this scenario. For more complex Tracts the interested reader is again referred to our
project website.
-- SRC/TRG: For each class, a CREATE TABLE statement has to be produced
File . allInstances &gt; exists ( f j f . name = ’db_schema’ and Class . allInstances &gt;
forAll ( c j f . lines &gt; exists ( l j l . text . matchesRE ( ’ˆCREATE TABLE ’ + c . name ) ) ) )</p>
    </sec>
    <sec id="sec-3">
      <title>Realization of TractsTool</title>
    </sec>
    <sec id="sec-4">
      <title>Conclusions and future work</title>
      <p>We have presented the foundations of TractsTool, a tool for light-weight verification of
any kind of model transformation by following the Tracts approach.</p>
      <p>
        There are several lines of research that are still subject to ongoing work. Firstly, we
plan to investigate how the Knowledge Discovery Metamodel (KDM) may be used for
defining contracts that are programming language independent and reusable for a
family of code generators. Secondly, the TractsTool’s internal transformations presented in
Section 4 are time-consuming when transforming very large models. Another objective
is to provide a mechanism to generate automatically the ASSL program that in turn
generates a set of default input models so that the user is not required to develop such
programs by hand. Another improvement that may be made is to change the information
that is displayed after the verification process. Specifically, diagnostic models are an
interesting line of research in this respect. Finally, we plan to include error tracking [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]
directly in TractsTool. Thus, in case a Tract fails, the transformation engineer should be
supported in identifying the transformation rule(s) that have caused the failure.
Acknowledgements. This work is partially funded by Research Project TIN2011-23795.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Amrani</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lucio</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Selim</surname>
            ,
            <given-names>G.M.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Combemale</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dingel</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vangheluwe</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Traon</surname>
            ,
            <given-names>Y.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cordy</surname>
            ,
            <given-names>J.R.:</given-names>
          </string-name>
          <article-title>A Tridimensional Approach for Studying the Formal Verification of Model Transformations</article-title>
          .
          <source>In: Proc. of the 1st Workshop on Verification of Model Transformations (VOLT) @ ICST</source>
          , IEEE (
          <year>2012</year>
          )
          <fpage>921</fpage>
          -
          <lpage>928</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Cabot</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Clariso</surname>
            <given-names>´</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Guerra</surname>
          </string-name>
          , E.,
          <string-name>
            <surname>de Lara</surname>
          </string-name>
          , J.:
          <article-title>Verification and validation of declarative model-to-model transformations through invariants</article-title>
          .
          <source>JSS</source>
          <volume>83</volume>
          (
          <issue>2</issue>
          ) (
          <year>2010</year>
          )
          <fpage>283</fpage>
          -
          <lpage>302</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Troya</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vallecillo</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>A Rewriting Logic Semantics for ATL</article-title>
          .
          <source>JOT 10</source>
          (
          <year>2011</year>
          ) 5:
          <fpage>1</fpage>
          -
          <lpage>29</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Brottier</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fleurey</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Steel</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baudry</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Traon</surname>
            ,
            <given-names>Y.L.</given-names>
          </string-name>
          :
          <article-title>Metamodel-based Test Generation for Model Transformations: an Algorithm and a Tool</article-title>
          .
          <source>In: Proc. of the 17th Int. Symposium on Software Reliability Engineering (ISSRE)</source>
          ,
          <source>IEEE</source>
          (
          <year>2006</year>
          )
          <fpage>85</fpage>
          -
          <lpage>94</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Fleurey</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baudry</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Muller</surname>
            ,
            <given-names>P.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Traon</surname>
            ,
            <given-names>Y.L.</given-names>
          </string-name>
          :
          <article-title>Qualifying input test data for model transformations</article-title>
          .
          <source>SoSym</source>
          <volume>8</volume>
          (
          <issue>2</issue>
          ) (
          <year>2009</year>
          )
          <fpage>185</fpage>
          -
          <lpage>203</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Cariou</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Belloir</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Barbier</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Djemam</surname>
          </string-name>
          , N.:
          <article-title>OCL contracts for the verification of model transformations</article-title>
          .
          <source>ECEASST</source>
          <volume>24</volume>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bohling</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Richters</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Validating UML and OCL Models in USE by Automatic Snapshot Generation</article-title>
          .
          <source>SoSym</source>
          <volume>4</volume>
          (
          <issue>4</issue>
          ) (
          <year>2005</year>
          )
          <fpage>386</fpage>
          -
          <lpage>398</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Wimmer</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Burguen˜o,
          <string-name>
            <surname>L.</surname>
          </string-name>
          :
          <article-title>Testing M2T/T2M Transformations</article-title>
          .
          <source>In: Proc. of the 16th Int. Conf. on Model Driven Engineering Languages and Systems (MODELS)</source>
          .
          <article-title>Volume 8107 of LNCS</article-title>
          ., Springer (
          <year>2013</year>
          )
          <fpage>203</fpage>
          -
          <lpage>219</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vallecillo</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Tractable Model Transformation Testing</article-title>
          .
          <source>In: Proc. of the 7th European Conf. on Modeling Foundations and Applications (ECMFA)</source>
          .
          <article-title>Volume 6698 of LNCS</article-title>
          ., Springer (
          <year>2011</year>
          )
          <fpage>221</fpage>
          -
          <lpage>236</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Cabot</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Object Constraint Language (OCL): the Definitive Guide</article-title>
          . In:
          <article-title>Formal Methods for Model-Driven Engineering</article-title>
          . Volume
          <volume>7320</volume>
          of LNCS., Springer (
          <year>2012</year>
          )
          <fpage>58</fpage>
          -
          <lpage>90</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Bu¨ttner,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Richters</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.:</surname>
          </string-name>
          <article-title>USE: A UML-Based Specification Environment for Validating UML and OCL</article-title>
          . SCP
          <volume>69</volume>
          (
          <issue>1-3</issue>
          ) (
          <year>2007</year>
          )
          <fpage>27</fpage>
          -
          <lpage>34</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12. Burguen˜o,
          <string-name>
            <given-names>L.</given-names>
            ,
            <surname>Wimmer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Vallecillo</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          :
          <article-title>Towards Tracking Guilty Transformation Rules</article-title>
          .
          <source>In: Proc. of the 1st Workshop on the Analysis of Model Transformations (AMT) @ MODELS, ACM</source>
          (
          <year>2012</year>
          )
          <fpage>27</fpage>
          -
          <lpage>32</lpage>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>