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. For example, you can write a suite for tests which are not related to generation as follows:
import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ EntitiesParserTest.class, EntitiesFormatterTest...