Assess a Model by Using When Decomposition

This example shows how to use When decomposition in a Test Sequence block to author assessments in a test harness.

This model implements a simple signal tracker that operates in three modes: 0 (Off), 1 (Slow), and 2 (Quick).

To observe the output and error of the signal tracker, simulate the model.

Open the Test Harness

The SimpleTracker subsystem has a test harness that contains a Test Assessment block.

The Test Assessment block assesses the behavior of the SimpleTracker subsystem by using a When decomposition test sequence.

The test sequence determines the appropriate assertions to run based on the value of mode. The CheckError step has a When decomposition with three substeps:

  • OffMode is active when the value of mode is 0 (Off).

  • SlowMode is active when the value of mode is 1 (Slow).

  • QuickMode is active for all other values of mode.

Run the Model Assessments

To run the assessments, simulate the test harness.

See Also


Related Topics