Example: Test a model-to-text transformation with EUnit

  var sb := new Native("java.lang.StringBuilder");
  process(sb, "", Tree.allInstances.select(s|s.parent.isUndefined()).first());


  operation process(sb, indent : String, node : Tree) : String {
    sb.append(indent + "- " + node.label + "\n");
    for (child in node.children) {
    process(sb, indent + "  ", child);
var EXPECTED_PATH  = basedir + "/expected.txt";
var GENERATED_PATH = basedir + "/tree.txt";

@Spec {
  Metamodel "TreeMetamodel" {
    nsUri: "Tree"

Model {
  Tree "A" {
    label: "A"
  Tree "B" {
    label: "B"
    parent: Tree "A"
  Tree "C" {
    label: "C"
    parent: Tree "B"
  Tree "D" {
    label: "D"
    parent: Tree "B"
  Tree "E" {
    label: "E"
    parent: Tree "A"

operation loadModels() {
  loadHutn("Tree", EXPECTED_MODEL);

operation expectedModelGeneratesExpectedFile() {
- A
  - B
    - C
    - D
  - E
<project default="run-tests">

  <target name="run-tests">
    <epsilon.emf.register file="tree.ecore"/>
    <epsilon.eunit src="tests.eunit" failOnErrors="false">
      <parameter name="basedir" value="${basedir}"/>

  <target name="tree2text">
    <epsilon.egl src="tree2text.egl" target="${basedir}/tree.txt">
      <model ref="Tree"/>


Clone Epsilon's Git repository and then:

Once you have checked out/imported the code, to run the example you need to go through the following steps:

  1. register any .ecore metamodels in the org.eclipse.epsilon.eunit.examples.egl.files project
  2. right click the .launch file in the org.eclipse.epsilon.eunit.examples.egl.files project
  3. select Run as... and click the first item in the menu that pops up

What's this?

In this example we show how a model-to-text transformation written in EGL can be tested with EUnit and HUTN.

What are .emf files?

.emf files are Ecore metamodels expressed using the Emfatic textual syntax.

More examples...

Epsilon Object Language
Epsilon Transformation Language
Epsilon Generation Language
Epsilon Validation Language
Epsilon Merging Language
Epsilon Flock
Epsilon Model Generation Language
Epsilon Pattern Language
Combining the Epsilon Languages

Even more examples...

More examples are available in the examples folder of the Git repository.