Automated generation of test cases using model-driven architecture

In this paper, we demonstrate a method that uses the model transformation technology of MDA to generate unit test cases from a platform-independent model of the system. The method we propose is based on sequence diagrams. First we model the sequence diagram and then this model is automatically transformed into a general unit test case model (an xUnit model which is independent of a particular unit testing framework), using model-to-model transformations. Then model-to-text transformations are applied on the xUnit model to generate platformspecific (JUnit, SUnit etc.) test cases that are concrete and executable.
We have implemented the transformations in a prototype tool based on the Tefkat transformation tool and MOFScript. The paper gives details of the tool and the transformations that we have developed. We have applied the method to a small example (ATM Simulation).
1. Introduction
This paper presents an application of Model-Driven Architecture (MDA) in the context of software verification and validation (V&V).
MDA is an initiative by the OMG (the Object Management Group) to support the development of interoperable, portable and reusable software systems [1]. In MDA, models at various levels of abstraction are the central software design artifact. They are used to facilitate both abstraction and automated development. A simple use of MDA is to model an application in a platform-independent modeling language (e.g. UML). The platform-independent model (PIM) can then be translated into a platformspecific model (PSM) by writing transformation specifications that are mappings between the PIM and some implementation language (e.g. Java) [2]. MDA tools can partially automate the development process by generating most of the code from models resulting in less code to hand-craft [3].
Software V&V is an important quality assurance activity of the software development process. It emerged in the late 1960s as the use of software in military and nuclear-power systems increased [4]. It can play its part throughout the software development life cycle, from requirement specification to actual delivery of the product. An important aspect of V&V is to test the behaviour of a system.
Traditionally software products were verified and validated based upon their specifications [5] or their implemented source code. More recently, modelbased testing has become popular [6]. Researchers are investigating the use of software models to support V&V activities. A major advantage of modelbased V&V is that it can be easily automated, saving time and resources. Other advantages are shifting the testing activities to an earlier part of the software development process and generating test cases that are independent of any particular implementation of the design.
Not all model-based testing uses MDA. “Modeldriven testing” is a form of model-based testing that uses model-transformation technology using models, their meta-models and a set of transformation rules (that are defined in terms of mappings between the elements of meta-models) [7]. The tools based on the model-driven approach automate V&V activities by specifying and executing transformation rules, which reduces the development time and makes their maintenance easier.
We propose a model-driven approach to test software applications using sequence diagrams. Sequence diagrams are behavioural elements of a UML design [8] that describe dynamic interactions among the components of a system.