Extend Test Cases for Modified Model
Suppose that you have a model that you have already analyzed using Simulink® Design Verifier™, and you modify the model. The original test suite may not record 100% coverage for the modified model. Reanalyze the modified model to make sure that it satisfies all the new test objectives. Instead of reanalyzing the entire model, you focus the new analysis on just the modified part of the model. In this way, you leverage the test cases created for the original model, extending them to satisfy any new objectives.
This example uses the
sldvdemo_cruise_control model. You analyze
the model and generate test cases. Then you analyze a modified version of that model,
sldvdemo_cruise_control_mod, extending the test cases from the
original analysis. The analysis returns a complete test suite for the new model.
Create Starting Test Cases
sldvdemo_cruise_control model and generate test
cases that achieve 100% coverage.
Open the example model:
To start a Simulink Design Verifier analysis for the
sldvdemo_cruise_controlmodel, double-click the Run Simulink Design Verifier block.
The analysis satisfies 34 test objectives for the
sldvdemo_cruise_controlmodel. The software stores the resulting data file in a subfolder of the MATLAB® Current Folder:
In the next section, when you analyze the modified model, this data file specifies the starting test cases that you extend.
sldvdemo_cruise_controlmodel and all the files created by the analysis. If asked, do not save any changes you made to the model.
Extend Existing Test Cases
sldvdemo_cruise_control_mod model is a modified version of
sldvdemo_cruise_control. The Controller subsystem contains a
Saturation block that specifies that the target speed cannot exceed 70.
Open the modified model and analyze it, extending the test cases that you
generated when analyzing the
Open the example model, the modified version of
Double-click the Controller subsystem to see the change to the original model, a Saturation block that specifies the maximum speed:
Close the Controller subsystem.
On the Design Verifier tab, click Test Generation Settings.
In the Configuration Parameters dialog box, on the Test Generation pane, under Existing test cases, select Extend existing test cases.
In the Data file field, click Browse and navigate to the MAT-file created in the MATLAB Current Folder when analyzing the original model:
Clear Ignore objectives satisfied by existing test cases.
When you clear this option, the analysis includes the test cases recorded in the file
sldvdemo_cruise_control_sldvdata.matin the final test suite.
Click Apply to save these settings.
To start the analysis, click Generate Tests.
The analysis first loads the 34 objectives satisfied by the initial test cases. Then it adds extra time steps to those test cases and tries to satisfy any missing objectives.
In the Results Summary window, click Generate detailed analysis report.
The analysis satisfied a total of 38 satisfied objectives for the
sldvdemo_cruise_control_modmodel. The analysis satisfied four additional objectives that correspond to the Saturation block.