测试框架
通过使用测试框架为您的模型创建特定于测试的仿真环境。您可以隔离用于单元测试的各个模块,还可以添加输入、验证逻辑和仪表板模块。通过将物理被控对象模型添加到测试框架来执行闭环测试。在更改生产模型之前,通过测试框架测试潜在的设计更改。
与使用单独的模型进行单元测试相比,测试框架在模型画布中提供了管理和同步功能。如果模型正在进行变更管理,您可以将测试框架保存在外部文件中,而无需更改主模型。
您可以通过在 SIL 或 PIL 模式下仿真测试框架来测试生成的代码。您还可以通过为 C Caller 或 S-Function 模块创建测试框架来测试外部人工代码。
工具
测试管理器 | Model and code testing in different execution environments, manage test suites, and analyze and report results |
主题
- Test Harness and Model Relationship
Test a Simulink® model in an isolated environment, using a separate workspace and configuration set accessed via the model canvas.
- 创建测试框架
使用测试框架隔离在测组件。
- Create or Import Test Harnesses and Select Properties
Create, import, and customize test harness configurations for your model and subsystem.
- Manage Test Harnesses
Manage test harnesses, including opening, converting, closing, deleting, and exporting.
- Synchronize Changes Between Test Harness and Model
Transfer configuration sets and workspace variables, update component design, and rebuild harness to reflect the latest design.
- Test Harness Construction for Specific Model Elements
Describes how test harnesses are constructed for certain Simulink semantics and component types.
- Test Library Blocks
Test reusable components using tests for libraries, library blocks, and linked blocks.
- Customize Test Harnesses
Create reusable functions and callbacks that customize test harnesses.
- Create Test Harnesses from Standalone Models
Import standalone models as test harnesses in Simulink Test™.
- Use Stateflow Chart for Test Harness Inputs and Scheduling
Use Stateflow Chart to define test harness inputs and test sequence.