Skip to content

Transformation test case specification

Ákos Horváth edited this page Jun 29, 2015 · 2 revisions

Testing model transformations

Basic concepts

Source instance model

In this case, the source instance model is a pre-prepared instance model, which is transformed by the transformation method under test. It is purpose built for every test case, aiming to trigger the tested functionality.

Target instance model

The target instance model contains the result of the transformation and in each test case it is compared to an expected result. In some cases, the target instance model is prepared to some extent by the test case itself. This is necessary during mapping test cases, as the effects (or lack of them) of other transformation mappings could affect the test results.

Transformation mapping

Model-to-model transformations consist of numerous transformation mappings. These mapping define, that a certain typed element(s) in the source model should be transformed to a given target model element(s).

Types of transformation tests

Mapping tests

As stated previously, model transformations are basically a set of mappings between source and target model elements. Transformation mapping tests check if the transformation implements these mapping according to its specification. Mapping tests can be loosely regarded as unit tests for model transformations.

Integration tests

Similar to regular software testing, integration tests also play an important role in the field of testing model transformations as well. These integration test specify more complex source and expected target models, which cover the functionality of multiple mappings

Test case header template

The main idea behind this page is that if the individual test case specifications follow a predefined formula, the test specification deliverable can be created from individual test case specifications. In this case, these test specifications are JavaDoc header comments that consist of the following sections.

Short textual description of the test case

In this section the following should be specified in a short, textual form.

  • Type of the test (mapping/integration)
  • Short description of the functionality to be tested
  • How does the source model trigger this functionality

Source instance model specification

In this section the structure of the source instance model is specified. It can be done in either textual or a better structured form, for example a tree. In case of complex source models, (typical for integration tests) only the parts of the model which bare actual relevance of the test case should be specified.

Target instance model before the transformation

This section specifies that to what extent should the target model be prepared by the test case, to avoid unnecessary dependency on certain untested functions.

Expected target instance model after the transformation

Finally, the expected target model should also be specified. Similar to the case mentioned before, if complex models are involved, only the relevant parts of the model should be specified.

EMDW-MC transformation test projects

The projects below should provide an example for the application of the aforementioned test case specification template

com.incquerylabs.emdw.cpp.transformation.test

com.incquerylabs.emdw.umlintegration.transformation.test

Clone this wiki locally