Model and code testing in different execution environments, manage test suites, and analyze and report results
You can use the Test Manager to create test cases for Simulink® models and code in desktop, SIL, PIL, and HIL (for target computers running Simulink Real-Time™) execution environments. You can create or import test data, run tests, view results, and create reports. You can also import and test C and C++ code, and MATLAB® test scripts.
You can group test cases into test suites, which are saved in a test file. The types of test you can create are simulation tests, equivalence (back-to-back) tests to compare models or generated code, and baseline tests to compare model output to a known baseline. You can run tests directly on your model or use test harnesses, which keep the test environment separate from your model. See Test Harness and Model Relationship.
You can specify the model or component to test, as well as:
Test outputs, such as logged signals and states
Baseline criteria for baseline tests
Iterations to run different combinations of inputs, parameters, baseline criteria, etc.
Temporal and logical assessments of simulation behavior
Model parameter and configuration overrides
Callbacks to run before and after loading the model
Coverage settings to measure the extent to which model or code execution paths are exercised
Link requirements to the tests that verify them
If your model or test harness contains a To Workspace block, the block variable is not saved in the base workspace after the test finishes running. Upon test completion, the base workspace is restored to its original state.
Open the Test Manager
In the Simulink toolstrip
Open the Apps tab.
In the Model Verification, Validation, and Test section, click Simulink Test.
On the Tests tab, click Simulink Test Manager on the Tests toolstrip.
At the MATLAB command prompt, enter
In the Test Manager, the test sections in the Test Browser pane contain the options for the test. For descriptions of the options, see Specify Test Properties in the Test Manager.
By default, running a test in the Test Manager disables breakpoints for Simulink, Stateflow®, and Test Sequence blocks. Use Run with Stepper in the Test Manager to run a test in the simulation stepper and use the breakpoints there.