Skip to content

MPS Generator Testing

This is a small guide for testing the MPS model translation with generator tests, more details can be found on this link.

  1. Create a new Model in a fitting Solution using by right-click.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Enter a proper name and make sure to select "@tests"

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Import the language "jetbrains.mps.lang.test.generator" and finish the test model creation.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Now you can start creating generator tests, by right-click on the test model.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. After creating the generator test you need to create the input model you want to test.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Enter a proper name and make sure to unselect the "@test".

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Add the language of the input model and finish the model creation. Do the same creation for the expacted output model.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Finally you should have these modules:

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom


Creating tests

To create tests you need to create specific input and output models:

  1. Right-click on the models and create a new deployment model for each.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Now add the features you want to test and define the expected output. Use the keys ctrl + space in the deployment models to add components.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. After adjusting these models, write the test in the generator test file. Use ctrl + space to see the possible testing options.

DeMAF_Overview
Hold "Alt" / "Option" to enable pan & zoom

  1. Now you can run the test by using right-click.