You can define test harness scheduling using a Test Sequence block, a MATLAB® Function block, or a Stateflow® chart. If you use a Stateflow chart as a scheduler, you can use Stateflow features that are not available with either the Test Sequence block or MATLAB Function block. You can define more complicated scheduling by using Stateflow variants, graphical functions, super transitions, and super steps. For example, with Stateflow variants, you can specify multiple test scenarios in a single test harness. If you do not need to test multiple test scenarios or use complicated sequence logic, use the Test Sequence block, which has simpler syntax for test scheduling.
You must have a Stateflow license to use a chart for test harness inputs or scheduling.
To use a Stateflow chart as a test harness test scheduler, the model or subsystem under test must have at least one function call signal.
When setting up a test harness from a model, the steps for using a chart as the scheduler are:
In a model or subsystem, right-click and select Test Harness > Create for Model or Create for <subsystem>, respectively.
For a model, in the Create a Test Harness dialog box, set
Add scheduler for function-calls and
rates to Chart
.
For a subsystem, in the Create a Test Harness dialog box, set
Generate function call signals to
Chart
.
A chart named Simulink Function scheduler is added to the test harness.
Open the Stateflow chart and define the test sequence using Stateflow states, transitions and other objects. The Stateflow states serve the same purpose as the sequence steps in a Test Sequence block. The transitions define the criteria for moving from one state to another.
To programmatically specify a Stateflow chart as a scheduler, set the SchedulerBlock
property
of sltest.harness.create
to Chart
.
When creating a test harness from a model, the steps for using a chart as the test harness source are:
In a model or subsystem, right-click and select Test Harness > Create for Model or Create for <subsystem>, respectively.
In the Create Test Harness dialog box, in the Sources and
Sinks section, select Chart
instead of Inport
.
A chart is added to the test harness. For example,
Open the Stateflow chart and define the test harness sources using Stateflow logic.
To programmatically specify a Stateflow chart as a source, set the Source
property of
sltest.harness.create
to Chart
.
Function
Caller | Test Sequence | sltest.harness.create