Writing JUnit-based tests for Xtext-based domain specific languages (DSLs) can be quite cumbersome; they often contain redundant content and cannot be used to explain and discuss the language with others (in particular with future users of the DSL). What if one could embed test expectations within comments in example documents? What if one could find a format for these comments so they're both human-understandable and automatically verifiable by a test suite? Eclipse Xpect realizes this idea.
The focus of Eclipse Xpect is on testing Xtext languages and supporting the process of designing such languages. Thus, the scope of Xpect is limited to Xtext-based languages. Although the focus is on writing tests, it may also be used in final products, e.g., for the simplification of writing bug reports.
Eclipse Xpect is a unit- and integration-testing framework to be used for Xtext-based languages. Test data (e.g. expectations) are embedded into programs written in the DSL under tests. Xpect itself is based on Junit; new test methods can be written in Java and are called by the Xpect framework with the test data. Typical Xpect tests include expecting certain error messages, ensuring correct scopes, or specific content assist proposals.
Eclipse Xpect is based on Eclipse Xtext and it is used for Xtext-based languages. It dramatically simplifies the creation of tests for such languages and is therefore an interesting tool for any Xtext developer. Other Eclipse projects using Xtext may use Xpect for testing their DSL. This is already true for Eclipse N4JS which heavily relies on Xpect. Hosting Xpect at Eclipse enormously simplifies using it in other Eclipse projects such as N4JS.
The current version is already stable (the first version was created in 2012) and has been in production mode (as part of other projects, e.g., Eclipse N4JS) for years. Fixing bugs and adding minor improvements is an ongoing process, of course. Adding new features highly depends on the needs of projects using Xpect. Simplifying cooperation with existing or new projects within Eclipse (or related to Eclipse/Xtext) is one of the goals why we want to bring Xpect to Eclipse.
The project is already using a build process similar to the one used by Eclipse projects so it should be possible to quickly set up the Eclipse project with a nightly build once the project is approved and the initial contribution has gone through the due diligence process.
Projects:
- Eclipse Xtext
- Eclipse N4JS
Companies:
- itemis AG
- TypeFox GmbH
- NumberFour AG
The current code that will be contributed to the project is currently hosted at github (see https://github.com/meysholdt/Xpect) and made available under the Eclipse Public License already. Moritz Eysholdt has written almost the entire codebase. Other contributors are identifiable via the GitHub contributors.
The copyright is held by itemis and TypeFox - both companies support this proposal. The project does not use any non-Eclipse third-party libraries.
- Log in to post comments