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
sltestTestSeqDebuggingExample, which is in the
matlab/help//toolbox/sltest/examples folder. To open the model,
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.
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.
You enable debugging for a test sequence by adding one or more regular or conditional breakpoints. Regular 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. Conditional breakpoints halt simulation only when the specified condition is met. When simulation halts, you can view the data used in the test sequence to investigate the sequence simulation behavior.
You can add regular and conditional breakpoints to test step actions and transitions.
To add a regular breakpoint to a test step, right-click the step or action and select Break while executing step. For a transition, point to the transition, click the gear icon , and select Break when transition taken. A red icon indicates a regular breakpoint.
To add a conditional breakpoint, first add a regular breakpoint. Then, right-click the breakpoint icon and select Set or Modify Condition.
In the text field of the dialog box, specify the condition to apply to the step or transition and click Apply Condition. To indicate that it is a conditional breakpoint, the icon color changes to yellow.
To change a conditional breakpoint back to a regular breakpoint, right-click the breakpoint icon and select Set or Modify Condition. Delete the conditional text and click Apply Condition. The breakpoint icon color changes to red.
You can remove a breakpoint using these methods:
Click the breakpoint icon.
Right-click the breakpoint icon and select Clear Breakpoint.
For a step or action, right-click the step breakpoint icon and deselect Break while executing step. For a transition, point to the transition, click the gear, and deselect Break when transition taken.
After adding breakpoints, simulate the test sequence by clicking Run.
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.
When simulation halts, you can step through the test sequence using the toolbar buttons.
|Simulate until breakpoint||Simulation runs until the next breakpoint|
|Step forward through simulation time||Simulation advances one simulation step|
|Step forward through test step actions and transitions||Simulation 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 function||Simulation 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 function||Simulation 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.|