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.

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.

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.

  1. Active Call
  1. In the following example, states A and A1 are active.

    This gives rise to the following superstate/substate decisions:

  1. During processing of state A1, all its outgoing transitions are tested. This decision belongs to the transition and not to its parent state A. In this case, the transition marked by condition C2 is tested and a decision is made whether to take the transition to A2 or not. See Conditional Transition Decision.

  1. Implicit Substate Exit Context
  1. In the following example, a transition takes place whose source is superstate A and whose destination is state B. If the superstate has two exclusive (OR) substates, it is the decision of superstate A as to which of these substates will perform the implicit transition from substate to superstate.

  1. Substate Entry with a History Junction
  1. A history junction, similar to the one shown in the example following, provides a superstate with the means of recording which of its substates was last active before the superstate was exited. If that superstate now becomes the destination of one or more transitions, the history junction provides it the means of deciding which previously active substate to enter.

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.


  Cyclomatic Complexity Condition Coverage