Have you ever wanted to perform a regression test on a library you have created? Model Management, an optional library available in Dymola, could provide the solution. This article will highlight the key features of the Model Management library for checking your library.
When you open the Model Management library, you will see that it contains three packages; Check, Compare and Structure. It is the Check package which is of interest, as it contains the checkLibrary function which allows you to:
- Perform regression testing of the test cases in your library, to identify unintended changes to model behaviour. This is done by comparing the possible continuous and discrete state variables in the current results to the reference results supplied.
- Generate the reference result files required for the regression test, by simulating the test cases and storing the result files.
- Perform class coverage analysis, to identify classes in your library which are not included in any test case.
- Perform condition coverage analysis, to identify conditions which have not been both true and false in the test cases.
- Check the style of the library, to identify model documentation which does not follow the style guide, i.e. missing description strings and documentation, bad names etc.
The function interface, shown below, allows you to configure the check performed by enabling or disabling the checking features. This interface also allows you to specify the library to be checked, as well as any additional test cases which exist outside of the library. For a model to be identified as a test case and included in the regression test, it must contain the simulation setup in the model annotation. An example of the necessary code is:
Once the check is complete, the results will be reported in html files stored in your current working directory. If you perform a style check, these results are stored in a second html file. Examples of the reports are given below, based on the example included in the Model Management library.
For a step-by-step guide on using the features of the Model Management library see the library documentation.