In this talk I give an introduction to a new Project at Eclipse (1): Xpect, a framework that allows to embed test expectations into comments inside your Xtext language. The approach is non-intrusive to your code, integrates with JUnit and has a smart editor for the Xpect-specific syntax.
Since Xpect separates DSL-Documents from Java-Test implementations, it becomes incredibly easy to add real-world code snippets to your test suite. You even can use your languages’s Xtext-Editor to edit your test cases.
In teams, this approach has proven very valuable to allow for an easy review of the language design and compliance of the language implementation.
I will also demo a new feature of Xpect: Now tests can be run live, as you type, as part of Xtext’s validation. Eclipse markers provide feedback regarding the text execution result. Feedback has never been faster.
1: As of writing this abstract, an project proposal has been submitted to the EMO.