Menu

extendingCitLab

Anonymous

How to extend CitLab with a new test generator

Besides the definition of a language for combinatorial problems, together with its editor, meta-model, and Java API to manipulate combinatorial models, a further goal of CITLAB is to introduce a framework for the definition and implementation of actual test generators and a set of exporters/importers to and from other languages to foster tools interoperability. In order to ease the development and deployment of such components that can extend its capabilities, CITLAB relies on the extension techniques as defined by the Eclipse framework. In Eclipse, a framework or platform can accept new contributions as plugins by defining extension points. External contributors can add to the framework new plugins by implementing extensions. One can think of an extension point as a port – an entry point for other plugins to offer services. An extension is a plug that connects to the right port. An extension point defines a contract between the platform and the service provider introduced as plugin. The extension implementation is the actual service which will be added to the platform by using the plugin mechanism of Eclipse. There are several benefits from this architecture. New plugins can be dynamically added and removed from the platform without recompiling them. Third-party tools can be easily added to the platform by registering them as extensions. A plugin includes some descriptive information and the platform extension point can decide how to use it. For instance, a plugin can declare to support a feature and the platform can decide if it is worth loading the extension or not. The development of a plugin is strongly decoupled with the development of the platform, making easy for third-parties to contribute to the framework. An extension point can be used to introduce a Java interface which must be implemented by its extensions. The plugin that define the extensions must define a class implementing the required interface in order to extend the platform with new functionalities and register its extension into the platform. The platform will become aware of new functionalities and will be able to create and call instances of that class when needed. CITLAB introduces four extension points:

<extensionpointid="importers"
   name="Importers"
   schema="schema/importers.exsd"/>
<extensionpointid="exporters"
   name="Exporters"
   schema="schema/exporters.exsd"/>
<extensionpointid="generators"
   name="Generators"
   schema="schema/generators.exsd"/>
<extensionpointid="testsuiteexporters"
   name="TestSuiteExporters"
   schema="schema/testsuiteexporters.exsd"/>

The project citlab.model contains the definition of the language and the Xtext utilities. The companion project citlab.model.ui contains the user interface for the language. The project citlab.testsuite introduces a simple meta-model, based on EMF, for tests and test suites. The project citlab.core introduces the extension points. Every plugin can extend the extension points defined in this component. The core plugin introduces also some APIs that can be used in order to implement specific generators. For instance, the following method:

Iterator<List<Pair<Parameter, String>>>
getTuples(CitModel m, int k)

can be used to list all the k-tuples for a model m, where each tuple is a List of pairs (Parameter,String). The utilities include methods for converting expression to CNF and checking if a test satisfies the constraints. We use the following conventions for plugin names. We use citlab.importer. projects to define importer components, which are able to translate combinatorial problems into the CITLAB language (for instance, we have defined an importer from feature models), while packages citlab.generator. define algorithms and techniques for test generation (some are presented in the next section). The packages citlab.tsexporter. define exporters for test suites (up to now CITLAB provides the tester with two pre-built exporters to Excel and to CSV format). We decided to define in citlab.externaltool. generators which use external tools for test generation. They define an exporter from CITLAB combinatorial model to the notation of an external tool and then use that tool to perform the test generation.

The image below shows how our plugins are implemented:


Related

Wiki: TableOfContents