Main Content

Test Harnesses

Unit testing, integrated code testing, closed-loop scenarios, library testing

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.


Test ManagerModel and code testing in different execution environments, manage test suites, and analyze and report results