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.
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:
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:
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.