Main Content

Verify and Validate Requirements

Using Simulink® Test™ and Requirements Toolbox™, you can verify requirements by linking to test cases. For more information, see Link Test Cases to Requirements (Requirements Toolbox).

You can author an architecture model in System Composer™ and then link requirements to model elements that satisfy those requirements. For more information, see Allocate and Trace Requirements from Design to Verification.

Use Test Harnesses to Verify System Design

A test harness is a model that isolates the component under test with inputs, outputs, and verification blocks configured for testing scenarios. You can create a test harness for a model component or for a full model. A test harness gives you a separate testing environment for a model or a model component.

A Simulink Test license is required to use the Simulink Test Manager (Simulink Test) and to create test harnesses for components. For more information, see Create a Test Harness (Simulink Test).

Create a test harness for a System Composer component to validate simulation results and verify design. To edit the interfaces while you are testing the behavior of a component in a test harness, use the Interface Editor.

Use Simulink Test to perform requirement-based testing workflows that include inputs, expected outputs, and acceptance criteria. For more information on using Simulink Test with Requirements Toolbox, see Link Test Cases to Requirements (Requirements Toolbox). Test harnesses are not supported for Adapter blocks in architecture models or for Component blocks that contain a Reference Component in software architecture models.

Create Test Harness for Airframe Component

This example uses the architecture model for an unmanned aerial vehicle (UAV) to create a test harness for a System Composer component. In the MATLAB® Command Window, enter this command.

scExampleSmallUAV

To create a test harness for the Airframe component:

  1. Right-click the component.

  2. Select Test Harness > Create for 'Airframe'.

  3. In the Create Test Harness dialog box, specify the name of your test harness and click OK.

Your test harness opens in a new window, and the Harness menu is available in the toolstrip.

Tip

If the model component is in an early step in the design process and not fully wired, then in the Create Test Harness dialog box, you can select the Advanced Properties tab and select Create without compiling the model.

Test harness example in the Small UAV architecture model.

Use the Simulink Test Manager (Simulink Test) with the test harness to create test files and test cases. For more information, see Test Harness and Model Relationship (Simulink Test) and Create or Import Test Harnesses and Select Properties (Simulink Test).

Combine Subsystems for Integration Testing

To test whether combined systems as a whole function as designed, you can create test harnesses around progressively larger systems or subsystems. Once these subsystems are connected, use a testing framework to confirm that requirements are satisfied.

Related Topics