Test Harnesses
Create a test-specific simulation environment for your model by using a test harness. You can isolate individual blocks for unit testing and add inputs, verification logic, and dashboard blocks. Perform closed-loop testing by adding physical plant models to the test harness. Test potential design changes in the test harness before you change the production model.
Compared to using separate models for unit testing, test harnesses offer management and synchronization capabilities in the model canvas. If your model is under change management, you can save test harnesses in external files, without changing the main model.
You can test generated code by simulating test harnesses in SIL or PIL mode. You can also test external handwritten code by creating test harnesses for C Caller or S-Function blocks.
Tools
| Simulink Test Manager | Testing models and code in different execution environments, manage test suites, and analyze and report results | 
Topics
- Test Harness and Model RelationshipTest a Simulink® model in an isolated environment, using a separate workspace and configuration set accessed via the model canvas. 
- Create a Test HarnessUse a test harness to isolate the component under test. 
- Create or Import Test Harnesses and Select PropertiesCreate, import, and customize test harness configurations for your model and subsystem. 
- Manage Test HarnessesManage test harnesses, including opening, converting, closing, deleting, and exporting. 
- Synchronize Changes Between Test Harness and ModelTransfer configuration sets and workspace variables, update component design, and rebuild harness to reflect the latest design. 
- Test Harness Construction for Specific Model ElementsDescribes how test harnesses are constructed for certain Simulink semantics and component types. 
- Test Library BlocksTest reusable components using tests for libraries, library blocks, and linked blocks. 
- Customize Test HarnessesCreate reusable functions and callbacks that customize test harnesses. 
- Create Test Harnesses from Standalone ModelsImport standalone models as test harnesses in Simulink Test™. 
- Use Stateflow Chart for Test Harness Inputs and SchedulingUse Stateflow Chart to define test harness inputs and test sequence.