Creating Baseline Tests
Verify simulation result against a baseline dataset created from a model.
This example shows you how to create baselines tests for a model. The example uses the model
sltestBaselineBasicExample to generate a baseline dataset of expected results by simulating the model. The baseline test case checks that the simulation results produce the same output as the baseline dataset, which determines the pass/fail criteria of the test case.
Open the Model and Test Manager
1. Open the model.
mdl = 'sltestBaselineBasicExample'; open_system(mdl);
2. From the model, in the Apps tab, click Simulink Test from the Model Verification, Validation, and Test section. Then click Test Manager in the Tests tab.
3. Create a new test file using the Test Manager toolstrip.
4. Name the test file, and save it in a writable folder.
1. Under System Under Test, for Model, enter
sltestBaselineBasicExample. Capture a baseline for the test case by expanding the Baseline Criteria section and clicking Capture. Save the file
BaselineData in a writable folder.
The test case runs, and baseline data is captured for the root outports.
2. Click Run from the toolstrip to execute the test.
Visualize Baseline Test Results
1. After the test completes, expand all rows in the Results and Artifacts pane. The test case passes because the simulation results match the baseline results.
2. Select the option button for
Out2 under Baseline Criteria Result to visualize the data comparison.
close_system(mdl, 0); clear mdl;