MATLAB: How to ensure the test sequence only checks for conditions when certain states are active, and not at every step

assertharnesslogicstateflowverificationverify

I have test harness that is testing transition conditions inside a Stateflow Chart. How do I ensure that my test sequence only tests conditions when certain states are active?

Best Answer

There are several ways to check for active states in Stateflow Charts. You can either check for active states directly with the command:
if (in(STATE))
Which returns true if that state is active, false otherwise. Or you can use active state outputs, which automatically sets an enumeration of your choosing based on active state, which then you can check like so:
if (myENUM == ChartsENUM )
To read about how to activate state outputs, read here:
The above checks can be added to your test sequence directly in if-else statements to activate test steps based on active state.