<!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>First Steps Towards Conceptual Schema Testing</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Universitat Politècnica de Catalunya</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2009</year>
      </pub-date>
      <abstract>
        <p>Like any software artifact, conceptual schemas of information systems can be tested. Testing conceptual schemas has some similarities with testing programs, but there are important differences. We present a list of six kinds of tests that can be applied to conceptual schemas. Some of them require complete schemas comprising both the structural and the behavioral parts, but we show that it is useful to test incomplete schema fragments. We introduce CSTL, a language for writing automated tests of executable schemas written in UML/OCL. We sketch the implementation of a test processor to automatically execute CSTL tests as many times as needed, following the style of the modern xUnit testing frameworks.</p>
      </abstract>
      <kwd-group>
        <kwd>Conceptual modeling</kwd>
        <kwd>Testing</kwd>
        <kwd>UML/OCL</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The need and the importance of software testing in information systems engineering
is undisputed. We adopt here the precise and concise definition of testing proposed by
Meyer: “To test a program is to try to make it fail”, from which the goal of
testing becomes “to uncover faults by triggering failures” [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Many other verification
techniques are used or are in research and development, but, in professional practice,
testing continues to be the dominant technique.
      </p>
      <p>
        Currently, most work in conceptual modeling assumes that conceptual schemas are
executable, and therefore they are software [
        <xref ref-type="bibr" rid="ref10 ref6 ref8">6, 8, 10</xref>
        ]. Then, a question naturally
arises: how can we test conceptual schemas?
      </p>
      <p>
        Most of the work in software testing assumes that the System Under Test (SUT)
consists of programs (objects, components) that provide only a set of operations and
testing a SUT means calling those operations with appropriate context and input
parameters, and checking that they return the expected outputs. For example, the
recent UML Testing Profile (UTP) is based on this assumption [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and the same
happens in popular testing frameworks like JUnit [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>
        If a conceptual schema were like an ordinary program, then its testing would not be
very different from testing code. However, a conceptual schema is knowledge or,
more precisely, it is the general knowledge that an information system needs to know
about the domain and about the functions it has to perform [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
      </p>
      <p>In this work we advocate the use of testing during the elicitation of the conceptual
schema as an early error detection practice to help increasing software quality.</p>
      <p>
        In our approach, the conceptual schemas under test consist of a structural
(sub)schema and a behavioral (sub)schema. The structural schema consists of a
taxonomy of entity types, a set of relationship types (either attributes or associations),
the cardinality constraints of the relationship types, and a set of other static constraints
formally defined in OCL. Entity and relationship types may be base or derived. The
behavioral schema consists of a set of event types. We adopt the view that events are
similar to ordinary entities and, therefore, that events can be modeled as a special kind
of entities, which we call event entities [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. Each event type has an operation
called effect() that gives the effect of an event occurrence. The effect is declaratively
defined by the postcondition of the operation.
      </p>
      <p>
        Testing conceptual schemas is as important as testing programs in projects that
follow OMG's Model Driven Development (MDD) approach [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], when the
transformation from Platform Independent Models (PIM) to Platform Specific Models
(PSM) is fully automatic. This requires complete conceptual schemas, that
is, conceptual schemas that include all structural and behavioral aspects.
      </p>
      <p>
        However, we have found that it makes sense to test also incomplete conceptual
schemas, as a means to increase their quality [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Even small fragments consisting of
a few entity and relationship types, integrity constraints and derivation rules can be
tested to uncover their faults.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Testing conceptual schemas</title>
      <p>
        In this paper, we adopt UTP's terminology and consider that a test case is a
"specification of one case to test the system including what to test with, which input,
result, and under which conditions....A test case always returns a verdict." The verdict
may be Pass, Fail, Inconclusive, and Error [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In general, we consider that the verdict
is Error when the conceptual schema or the test case is ill-formed (is not a valid
instance of the corresponding metaschema). The verdict is Fail if the knowledge
represented in the conceptual schema produces unexpected results according to the
specified assertions. Otherwise, the verdict is Pass.
      </p>
      <p>We analyzed that when we test a conceptual schema, a test case includes one or
more of the following test kinds:
─ Check that a given IB state is consistent. This kind of test can be used to
check that (1) the whole set of constraints and derivation rules behave as
expected; and (2) the set of constraints defined in the schema is strongly
satisfiable (because there is at least one consistent and non-empty IB state).
─ Check that a given IB state is inconsistent. A conceptual modeler writes this
kind of test to check that (1) the OCL constraints behave as expected; or (2) the
whole set of constraints and derivation rules behave as expected.
─ Check the contents of a given IB state. This kind of test can be used to check
that (1) the structural schema can be instantiated to represent a particular
domain state; (2) one or more derivation rules derive the expected results; (3) an
OCL navigational expression yields the expected results; or (4) the effect of one
or more domain events implies an expected result on the IB.
─ Check that a domain event may not occur in a given IB state. Domain event
types and queries may have constraints. The meaning is that the instances of
those types or queries may only occur in the domain if the constraints are
satisfied. A conceptual modeler writes this kind of test to check that (1) the
OCL event constraints behave as expected; and (2) the whole set of constraints
defined in the event or query does not allow its occurrence as expected.
─ Check that a domain event may occur in a given IB state. This kind of test
checks that the effect of a domain event occurrence is as expected. A conceptual
modeler writes this kind of test to check that (1) the OCL event constraints
behave as expected; (2) the whole set of constraints defined in the event behave
as expected; and (3) the method and the derivation rules of the derived constant
attributes and associations produce the expected results (satisfaction of
postconditions and static constraints).
─ Check that a predefined query produces the expected results. This kind of
test checks that the effect of a query gives the expected answer. A conceptual
modeler writes this kind of test to check that: (1) the query constraints behave as
expected; (2) the effect of one or more previously occurred domain events has
produced the expected results on the IB; and (3) the postcondition of the query
gives the expected results.
3</p>
    </sec>
    <sec id="sec-3">
      <title>The Testing Approach</title>
      <p>
        The Conceptual Schema Testing Language (CSTL) is a textual procedural language
for writing automated tests of executable conceptual schemas written in UML/OCL.
CSTL is inspired in, and is an evolution of ASSL [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] but oriented to the testing
activity. Moreover, we are designing CSTL in the style of the modern xUnit testing
frameworks, by formalizing the test assertions [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. By this way, tests expressed in
CSTL may be automatically executed as many times as needed.
      </p>
      <p>CSTL provide constructs for specifying the test kinds enumerated in Section 2.
Note that all test kinds involve an IB state that must be specified by the conceptual
modeler.</p>
      <p>A CSTL program consists of a fixture (may be empty), a set (may be empty) of
fixture components, and a set of one or more test cases. The fixture is a set of
statements that create a state of the IB and define the values of the common program
variables. It is assumed that the execution of each test case starts with an IB state and
the contents of the variables as defined by the fixture. With this assumption, the test
cases of a program are independent each other, and the order of their execution is
irrelevant.</p>
      <p>In CSTL, there are three kinds of test cases: concrete, abstract and abstract
invocation. A concrete test case is a set of statements that builds a state of the IB,
defines values of its variables, and executes one or more tests of one of the six test
kinds described in the previous section.</p>
      <p>An abstract test case is a parameterized test case intended to be invoked one or
more times in the same program. The parameters of an abstract test case may include
fixture components and variables. A fixture component is a named set of statements
that create a fragment of the state of the IB and define the values of a set of variables.</p>
      <p>An abstract test case invocation is the invocation of an abstract test case with the
desired values of the parameters.</p>
      <p>The execution of a concrete test case or of an abstract test case invocation always
returns a verdict. The verdict is obtained from the verdicts of the test kinds executed
by the test case.</p>
      <p>The result of the invocation of a CSTL program always returns also a verdict,
which is obtained from the verdicts of its test cases.
3.2</p>
      <p>The Test Processor</p>
      <p>We are developing a test interpreter that reads a CSTL program and executes its
statements. The test interpreter coordinates the execution of the tests (setting up
fixtures, computing verdicts, and so on) and invokes the services of the information
processor to create, remove and change entities, attributes and associations of the IB,
and also to evaluate OCL expressions over the IB. Moreover, it shows the results of
the test execution. The test manager stores the CSTL programs and requests their
execution to the test interpreter. The test manager also keeps track of the test results,
and maintains test statistics.</p>
      <p>
        Figure 2 shows the result of the execution of an example CSTL program. There are
two test cases that have failed, and therefore the global verdict is Fail. Note that the
test processor indicates the number of the lines where the tests have failed, and an
explanation of the failure in natural language.
A conceptual schema can be executable if there is a general-purpose information
processor (virtual machine) able to behave according to the structural and behavioral
rules defined in the conceptual schema [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        We are implementing the information processor reusing USE [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] as much as
possible. CSTL will be able to deal with richer conceptual schemas because: (1) it
allows derived entity and relationship types; (2) in particular, it allows derived
constant relationship types [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]; (3) events and predefined queries are conceptualized
as entities and not as operation invocations [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]; and (4) it deals with conceptual
schemas that allow multiple classification of entities.
      </p>
    </sec>
    <sec id="sec-4">
      <title>Conclusions</title>
      <p>
        We have seen that, like any software artifact, conceptual schemas of information
systems can be tested with the goal of "uncover faults by triggering failures" [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. We
have shown that testing conceptual schemas has some similarities with testing
programs, but there are important differences. We have presented a list of six kinds of
tests that can be applied to conceptual schemas. Some of these test kinds require
conceptual schemas that include all structural and behavioral aspects, but we have
seen that it makes sense to test also incomplete conceptual schemas. Small fragments
consisting of a few entity and relationship types, integrity constraints and derivation
rules can be tested to uncover their faults and, therefore, to increase their quality [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>We have introduced CSTL, a textual procedural language for writing automated
tests of executable conceptual schemas written in UML/OCL. As far as we know, this
is the first proposal of a language for testing conceptual schemas designed in the style
of the modern xUnit testing frameworks. We are implementing a Test Processor
that manages and executes CSTL programs.</p>
      <p>
        We believe that our work opens new directions for research and development in
conceptual modeling. First, it is necessary to develop a methodology for testing
conceptual schemas. In particular, it seems interesting to develop a test-driven
conceptual modeling methodology, similar to the popular Test-Driven Development
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Second, it is necessary to develop coverage criteria that measure the degree to
which a conceptual schema has been tested. Finally, conceptual schema testing should
be integrated with other existing verification techniques and tools.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Baker</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Ru</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Graabowski</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Haugen</surname>
            ,
            <given-names>O</given-names>
          </string-name>
          <string-name>
            <surname>; Williams</surname>
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Model-Driven Testing</surname>
          </string-name>
          .
          <article-title>Using the UML Testing Profile</article-title>
          . Springer,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Beck</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>Test-driven development: By example</article-title>
          .
          <source>Addison-Wesley Prof</source>
          . (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Gamma</surname>
          </string-name>
          , E.;
          <string-name>
            <surname>Beck</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          <article-title>JUnit: A cook's tour</article-title>
          .
          <source>Java Report</source>
          , pp.
          <fpage>27</fpage>
          -
          <lpage>38</lpage>
          ,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Bohling</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ; Richters,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Validating UML and OCL models in USE by automatic snapshot generation</article-title>
          .
          <source>Software &amp; System Modeling</source>
          ,
          <volume>4</volume>
          (
          <issue>4</issue>
          ),
          <year>2005</year>
          , pp.
          <fpage>386</fpage>
          -
          <lpage>398</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Griethuysen</surname>
            <given-names>JJ</given-names>
          </string-name>
          van (ed)
          <article-title>Concepts and terminology for the conceptual schema and the information base</article-title>
          .
          <source>ISO TC97/SC5/WG3</source>
          ,
          <year>1982</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Insfrán</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pelechano</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pastor</surname>
            ,
            <given-names>O. Conceptual</given-names>
          </string-name>
          <article-title>Modeling in the eXtreme</article-title>
          .
          <source>Information and Software Technology</source>
          ,
          <volume>44</volume>
          (
          <year>2002</year>
          )
          <fpage>659</fpage>
          -
          <lpage>669</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Lindland</surname>
            ,
            <given-names>O.I.</given-names>
          </string-name>
          ; Sindre,
          <string-name>
            <given-names>G.</given-names>
            ;
            <surname>Solvberg</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          “
          <article-title>Understanding Quality in Conceptual Modeling”</article-title>
          .
          <source>IEEE Software, March</source>
          <year>1994</year>
          , pp.
          <fpage>42</fpage>
          -
          <lpage>49</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Mellor</surname>
            ,
            <given-names>S.J.</given-names>
          </string-name>
          ; Balcer,
          <string-name>
            <given-names>M.J. Executable</given-names>
            <surname>UML</surname>
          </string-name>
          .
          <article-title>A Foundation for Model-Driven Architecture</article-title>
          .
          <source>Addison-Wesley</source>
          ,
          <year>2002</year>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9. Meyer, B.
          <source>Seven Principles of Software Testing. IEEE Computer</source>
          ,
          <year>August 2008</year>
          , pp.
          <fpage>99</fpage>
          -
          <lpage>101</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Olivé</surname>
            ,
            <given-names>A. Conceptual</given-names>
          </string-name>
          <string-name>
            <surname>Schema-Centric Development</surname>
          </string-name>
          :
          <article-title>A Grand Challenge for Information Systems Research</article-title>
          .
          <source>CAiSE</source>
          <year>2005</year>
          , LNCS 3520, pp
          <fpage>1</fpage>
          -
          <lpage>15</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Olivé</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          .
          <source>Conceptual Modeling of Information Systems</source>
          . Springer,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Olivé</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          ,;
          <string-name>
            <surname>Raventós</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <article-title>"Modeling events as entities in object-oriented conceptual modeling languages"</article-title>
          .
          <source>Data&amp;Knowledge Engineering</source>
          <volume>58</volume>
          (
          <year>2006</year>
          ) pp.
          <fpage>243</fpage>
          -
          <lpage>262</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>