'0 and 1 - Switch Coverage in State Transition Testing?

This question is not programming related but related to one of test case design the technique. State Transition Diagram technique provides Test coverage by identifying test conditions via N-1 switch transitions. I am confused about how to calculate the 0-switch and 1-switch coverage.

Adding screenshot of an example. Can anyone please explain how this can be solved? Thank you in Advance.

Question in screenshotDiagram for this Question



Solution 1:[1]

The number of 0-switch from a state equals to the number of the transitions of length 1 starting from that state. In this case you have:

  • ACT-ACT;
  • ACT-ACC;
  • ACT-DIS;
  • ACT-CLO.

So, from Activated there are 4 transitions of length 1.

1-switch coverage from a state equals to all the transitions of length 2 starting from that state. You can build up from what you found in the 0-switch case, knowing which states you can reach from Activated in 1 transition. Just compute all the 0-switch transitions from each of these 4 states:

  • ACT: (as computed earlier) ACT-ACT; ACT-ACC; ACT-DIS; ACT-CLO -> 4;
  • ACC: ACC-ACT; ACC-CLO -> 2;
  • DIS: DIS-ACT; DIS-CLO -> 2;
  • CLO: CLO-DIS; CLO-ACT; CLO-REM; CLO-ACC -> 4.

In total, there are 12 1-STs.

But this is without considering the constraints in the second part of the exercise description.

"If a claim in state Accepted has been Closed it can only be restored to the same state Accepted." -> it does not matter for the exercise, since we start from the state Activated.

"If a claim in state Activated has been Closed it can only be restored to state Activated." -> this constraint rules out ACT-CLO-ACC.

So, in the end, you have 11 valid 1-STs.

Solution 2:[2]

There are 4 0-Switch transitions (states that you can reach with 1 leap from the Activated status):

  • Activated
  • Accepted
  • Disputed
  • Closed

There are 12 1-Switch transitions (states that you can reach with 2 leaps from the Activated status), however only 10 of them are valid:

  • Activated - Activated
  • Activated - Accepted
  • Activated - Disputed
  • Activated - Closed
  • Accepted - Activated
  • Accepted - Closed
  • Disputed - Activated
  • Disputed - Closed
  • Closed - Activated
  • Closed - Removed

The final restriction indicates that only Closed - Activated can be done, so Closed - Disputed, and Closed - Accepted do not count.

Solution 3:[3]

Addendum for Marco answer<<

Total solution for 1-switch is 9.

You rule out ACT-CLO-ACC (as Marco said due to second restriction)

but You also rule out ACT-CLO-REM (This one nobody excluded) ACT-CLO-DIS (as Afner noted)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marco Filippone
Solution 2
Solution 3 Srdjan Nikolic