Article Preview
TopIntroduction
A model provides a representation of aspects of a system. This can include design models such as UML class or sequence diagrams, or implementation models, such as source code in a programming language. A metamodel is a model that is used to describe the structure of other models, modelling languages or domain specific languages. Each instance of a metamodel is then a model that can be regarded as a test case. These test cases are important not just for validating a metamodel itself, but also useful for testing the tools and frameworks that process the models defined by that metamodel such as model transformation.
For example, given a domain specific language L, say, a metamodel would usually define the abstract syntax and static semantics of the language. A typical representation of the metamodel would be as a UML class diagram (using a subset of the constructs) with constraints specified using the Object Constraint Language (OCL). A set of instances of this metamodel would be programs written in language L, and would allow language engineers to check that they had specified the relevant constructs correctly.
A number of approaches and tools have already provided a way of generating these instances (Ehriget al., 2009; González Pérez et al., 2012; Cabot et al., 2014). However, these instances are not measured via any criteria. At least, meeting some criteria such as standard coverage criteria for UML class diagram would help users to increase their confidence in designing or validating metamodels. Furthermore, users may also wish to generate instances that possess certain coverage metrics for other testing purposes such as using depth of inheritance tree for testing inheritance relationships. Thus, naively generating instances from a metamodel without taking account of coverage criteria or other properties is not very adequate.
This paper addresses the issue of generating metamodel instances satisfying coverage criteria. More specifically, this paper makes the following contributions:
Both two techniques that encode coverage criteria and graph properties into a set of SMT formulas. These formulas are then combined with the formulas generated from our previous work, and solved by using an external SMT solver (Wu et al., 2013). Each successful assignment for the formulas is interpreted as an instance. We have already automated this process into a tool to demonstrate the feasibility of this approach.
TopA metamodel is a structural diagram and can be depicted using the UML class diagram notation. Thus, the coverage criteria defined for UML class diagram can also be borrowed for metamodels. In particular, we focus on the coverage criteria presented in (Andrews et al., 2003) (Ghosh et al., 2003), especially the work focused on testing the structural elements of a UML class diagram. These coverage criteria are standard criteria for testing a UML class diagram and they are defined as follows:
- •
Generalisation coverage (GN) which describes how to measure inheritance relationships.
- •
Association-end multiplicity coverage (AEM) which measures association relationships defined between classes.
- •
Class attribute coverage (CA) which measures the set of representative attribute value combinations in each instance of class.