Stateflow | ![]() ![]() |
Decision Coverage
Decision coverage interprets a model execution in terms of underlying decisions where behavior or execution must take one outcome from a set of mutually exclusive outcomes.
Note Full coverage for an object of decision means that every decision has had at least one occurrence of each of its possible outcomes. |
Decisions belong to an object making the decision based on its contents or properties. The following table lists the decisions recorded for model coverage for the Stateflow objects owning them. The sections that follow the table describe these decisions and their possible outcomes.
Object |
Possible Decisions |
Chart |
If a chart is a triggered Simulink block, it must decide whether or not to execute its block. See Chart as a Triggered Simulink Block Decision. If a chart contains exclusive (OR) substates, it must decide which of its states to execute. See Chart Containing Exclusive OR Substates Decision. |
State |
If a state is a superstate containing exclusive (OR) substates, it must decide which substate to execute. See Superstate Containing Exclusive OR Substates Decision. If a state has on event name actions (which might include temporal logic operators), the state must decide whether or not to execute the actions. See State with On Event_Name Action Statement Decision. |
Transition |
If a transition is a conditional transition, it must decide whether or not to exit its active source state or junction and enter another state or junction. See Conditional Transition Decision. |
Chart as a Triggered Simulink Block Decision
If the chart is a triggered block in Simulink, the decision to execute the block is tested. If the block is not triggered, there is no decision to execute the block, and the measurement of decision coverage is not applicable (NA).
See Chart as Subsystem Report Section.
Chart Containing Exclusive OR Substates Decision
If the chart contains exclusive (OR) substates, the decision on which substate to execute is tested. If the chart contains only parallel AND substates, this coverage measurement is not applicable (NA).
See Chart as Superstate Report Section.
Superstate Containing Exclusive OR Substates Decision
Since a diagram is hierarchically processed from the top down, procedures such as exclusive (OR) substate entry, exit, and execution are sometimes decided by the parenting superstate.
Note Decision coverage for superstates applies to exclusive (OR) substates only. A superstate makes no decisions for its parallel (AND) substates. |
Since a superstate must decide which of its exclusive (OR) substates to process, the number of decision outcomes for the superstate is equal to the number of exclusive (OR) substates that it contains. In the examples following, the choice of which substate to process is made in one of three possible contexts.
A
and A1
are active.
This gives rise to the following superstate/substate decisions:
See State Report Section.
State with On Event_Name Action Statement Decision
A state that has an on
event_name
action statement must decide whether to execute that statement based on the reception of a specified event or on an accumulation of the specified event when using temporal logic operators.
See State Label Notation and Using Temporal Logic.
Conditional Transition Decision
A conditional transition is a transition with a triggering event and/or a guarding condition (see Transition Label Notation). In a conditional transition from one state to another, the decision to exit one state and enter another is credited to the transition itself.
See Transition Report Section.
Note Only conditional transitions receive decision coverage. Transitions without decisions are not applicable to decision coverage. |
![]() | Cyclomatic Complexity | Condition Coverage | ![]() |