Test suite

When you write several Junit classes, it becomes uncomfortable to run them individually; after all, you write unit tests because you want an automatic mechanism to test your implementation, and you want to run all tests with just one operation.

When Xtext first generates the projects for your DSL in the .tests plug-in project, it also generates a Junit launch which automatically runs all the Junit tests in that project. This launch can be found in the root folder of the test plug-in project; in our Entities DSL it is called org.example.entities.tests.launch. You can execute this launch by going to Run As | Junit Test.

If you need more control over the tests that must be run or you want to group some tests, you can write a Junit Test Suite ...

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.