I'm new to testing and I don't understand 0-switch coverage and 1-switch coverage very well, I understand the concept but I don't know how to solve some questions like this one

enter image description here

1 Answer 1


0-switch coverage is basically the testing for each valid transition. Since you don't have loops, you simply count the number of arrows.

1-switch coverage relates to the number of pairs of valid transitions. E.g., "3 -> 2 -> 1" is a pair of valid transitions. On the other hand, "3 -> 2 -> 4" and "3 -> 1 -> (whatever)" are not valid because you can't perform these paths.

N-switch coverage refers to N+1 valid transitions list.

You can find an algorithm to find all paths between two nodes here: https://stackoverflow.com/a/58446/2252076

Which you can adapt to discover all paths of length N.

  • I don't get why "3 -> 1 -> (whatever)" is not valid. We can go from "3 -> 1 -> 4" , can you clarify more please
    – user
    Commented Mar 16, 2021 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.