Child pages
  • HOWTO: Running module tests as part of MPS build
Skip to end of metadata
Go to start of metadata

Executing module tests as part of MPS build usually requires writing non-trivial build scripts, which then need to be integrated into the main MPS build script at the correct place. This HOWTO describes the easier solution, which requires declaring a TestModuleManifest  and keeping the jetbrains.mps.build.tests.generatedTests up-to-date.

Inner working details

The module tests during the MPS build are executed by the ant script  build/test.xml, which calls the targets "build" and "check" in the generated file build/tests/mpsTestModules.xml.

The prototype model of the latter file (jetbrains.mps.ide.build.tests.generatedTests) is itself generated from the user-defined test manifests collected in another auxiliary model (jetbrains.mps.build.mps.testModules). 

This last model contains a single instance of TestProjectConfiguration enumerating the test module manifests to be included in the test process. 

Following are the detailed instructions on using this functionality.

Step-by-step guide

  1. In your test model declare an instance of TestModuleManifest (a root node).
  2. Populate this instance with the references to languages/solutions that execution of your test require. 
    NOTE: only the modules in addition to the standard MPS configuration need to be listed.
  3. Open the model jetbrains.mps.build.mps.testModules and add a reference to this manifest to the list in mpsTestModules root.
    NOTE: this model contains a single instance of TestProjectConfiguration named "mpsTestModules". It is not expected to contain anything beside this root node.
  4. Invoke the action "Refresh Test Project" on the same root node mpsTestModules. This may require invoking "Go To Action".
    This action updates the contents of the model jetbrains.mps.ide.build.tests.generatedTests.
    NOTE: all manual changes in this model will be lost. DONT EDIT THIS MODEL.
    HINT: the action "Refresh Test Project" is defined by the plug-in solution build.mps.testManifest.pluginSolution.
  5. After running make on the project, the build files should be updated and ready to run the tests. 

 

Icon
 

1 Comment

  1. Note: the TestModuleManifest describes "plugin" part of the environment, i.e. languages to use and their runtime/accessory/... solutions. In fact, the final version should contain a list of SLanguages (or just plugins?), needed classes from solutions should be added automatically. However, it seems now only the language part is implemented

    On the other side, the TestInfo root allows to open a project with needed sources, or testmaterial. 

    In addition, we came up with a thought that the "project tests" story is not yet ready, the tests we have are mainly a "model tests", which operate on nodes, not on the while project structure. Would be nice to have one place to configure all the environment (including languages, project, models and modules).