Debug a Test Sequence

You can debug a test sequence using tools in the Test Sequence Editor. Debugging involves setting breakpoints to stop simulation, observing data and test sequence progression, and manually stepping through test steps. You can try these features using the model sltestTestSeqDebuggingExample. To open the model, enter


Save a copy of the model to a writable location on the MATLAB® path. Double-click the Test Sequence block to open the Test Sequence Editor.

View Test Step Execution During Simulation

By default, simulation animates the test sequence by highlighting active steps and transitions. Observing test step execution can help you debug, particularly when manually stepping through the test sequence. Adjust the animation speed using the Change Animation Speed button in the toolbar.

Animation speed affects simulation speed. If you slow down animation speed for debugging, return the speed to Fast or Lightning Fast when you finish debugging to avoid slowing your simulation. If you do not need the test step highlights and want the fastest simulation, choose None.

Set Breakpoints to Enable Debugging

You enable debugging for a test sequence by adding one or more breakpoints. Breakpoints halt simulation every time the test step is evaluated. Therefore, breakpoints on some test steps, such as When decomposition parent steps, halt simulation repeatedly because the step is evaluated repeatedly. When simulation halts, you can view data used in the test sequence to investigate the sequence simulation behavior.

You can add breakpoints to test step actions or transitions:

  • To add a breakpoint to a test step action, right-click the test step and select Break while executing step.

  • To add a breakpoint to a test step transition, right-click the test step transition and select Break when transition taken.

The editor displays a breakpoint marker. After adding breakpoints, simulate the test sequence by clicking Run.

View Data Values During Simulation

If the simulation pauses (for example, at a breakpoint), you can view the status of data used in a test step by hovering over the test step. The data values at the current simulation time display next to the test sequence cell.


If you advance the simulation to another stop (for example, using the keyboard shortcuts), the data display does not update. Move off the test step and then hover over the step again to refresh the values.

Step Through Simulation

When simulation halts, you can step through the test sequence using the toolbar buttons. Also see Debugging and Breakpoints Keyboard Shortcuts (Simulink).

ObjectiveDetailsToolbar Button
Simulate until breakpointSimulation runs until the next breakpoint
Step forward through simulation timeSimulation advances one simulation step
Step forward through test step actions and transitionsSimulation advances by each step of a test sequence, with pauses at actions and transitions. Does not step into a function call.
Step in to a test step group or called functionSimulation advances into the substeps of a parent step and executes each action and transition. Steps into a function call.
Step out of a test step group or called functionSimulation advances through the remaining substeps of a parent step and then out to the parent step hierarchy level. Also finishes execution of a function call.

See Also