Skip to content

Create a unittest

saroele edited this page Nov 21, 2014 · 1 revision

Creating a unittest is not hard, so try to do it for every model you create. Here are the steps:

  1. Make an example for your model (a minimalistic model that can be simulated as such)
  2. Run a simulation with the inputs/simulation settings you would like to have in the unittest
  3. Make a plot of the variables you want to compare in the unittest. Every time the unittest will be run, you model will be simulated and the result will be compared with the reference result for each of these variables.
  4. Go to File/Generate Script
  5. Click on command log
  6. Save the .mos file that will contain the command log in the right place in the IDEAS/Resources/Scripts/... folder
  7. Edit this file in a text editor and remove all lines before the line that simulated your model. Keep only the simulateModel() and plot() lines.

That's all. From now on, your example model will always be checked in the unittests.

Clone this wiki locally