Override the Simulation Mode During Test Execution
This example shows how to override the simulation mode when you run a test. You can run a test in a simulation mode without modifying the simulation mode specified in the test case or the model settings.
Open the Model
open_system("sltestCruiseControl.slx")
In this model, the simulation mode is set to normal.
Open the Test File and Run the Test Case
Open the Simulink Test Manager and load the test file.
sltest.testmanager.view
sltest.testmanager.load("sltestCruiseControlSimMode.mldatx");
In the Test Browser pane, select Simulation Mode Test Case. In the test case properties, expand the System Under Test section, then expand the Simulation Settings and Release Overrides section. This test case uses the Simulation Mode specified in the model settings.
On the toolstrip, click Run. In the Results and Artifacts pane, expand the results and select Simulation Mode Test Case. Confirm that the test uses normal simulation mode.
Run the Test Case in a Different Simulation Mode
In the Test Browser pane, select Simulation Mode Test Case. Click the Run drop-down, and select Run Selected in > Accelerator. In the Results and Artifacts pane, expand the second set of results and select Simulation Mode Test Case. The simulation runs in accelerator mode.
In the Test Browser pane, select Simulation Mode Test Case. Under System Under Test, in the Simulation Settings and Release Overrides section, the test file is not modified and does not display unsaved changes.
Clean Up
Clear and close the Test Manager. Then, close the model without saving.
sltest.testmanager.clearResults
sltest.testmanager.clear
sltest.testmanager.close
close_system("sltestCruiseControl.slx",0)