Implementing tests for your DSL
Xtext highly fosters using unit tests, and this is reflected by the fact that, by default, the MWE2 workflow generates a specific plug-in project for testing your DSL. In fact, usually tests should reside in a separate project, since they should not be deployed as part of your DSL implementation. This additional project ends with the .tests
suffix, thus, for our Entities DSL, it is org.example.entities.tests
. The tests plug-in project has the needed dependencies on the required Xtext utility bundles for testing.
We will use Xtend to write Junit tests.
In the src-gen
directory of the tests project, you will find the injector providers for both headless and UI tests. You can use these providers to easily write Junit ...
Get Implementing Domain-Specific Languages with Xtext and Xtend now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.