State Transition - Switch Coverage Explained

State Transition

In this post, I would like to explain more about State transition Testing and 'N- Switch' Coverage. Let us consider sample question below and try to solve it.

Q: Given the following state transition



Which of the following series of state transitions below will provide 0-switch
coverage?

Answers:
i) A, B, E, B, C, F, D.
ii) A, B, E, B, C, F, F.
iii) A, B, E, B, C, D.
iv) A, B, C, F, F, D.

Before jumping on to solving this question, Lets get concept of N-switch in this particular example its 0-switch. What do you think is this 0- switch ?

If every valid transition is tested considering one transition at a time then, this is known as “0-switch” coverage. If you test a series of transitions through more than one state. If you covered all of the pairs of two valid transitions, you would have “1-switch” coverage, covering the sets of 3 transitions would give “2-switch” coverage, etc.

0- Switch Coverage




I tried to draw single transaction that is possible from each state in the above diagram So, going over this:
SS - S1 = A so, now you are in S1 state look for possible transactions from state S1
S1 - S2 = B we are at S2, looking at diagram you can see there are two possible transaction
S2 - S1 = E so now we are back at S1 and we know from S1 only possible transaction is to S2 
S1- S2 = B as we already covered S2 - S1 lets cover other possibility now
S2 - S3 = C
S3 - S3 = F
S3 - ES = D

Hence, Answer to above question is i)

Going beyond this question, let me ask question differently. How many test cases are needed to cover 0 - switch ? In this case it is 6 test cases.

1- Switch Coverage

Considering same example above, below sketch gives idea of how 1- switch Coverage


In order to have 1- Switch coverage of this state transition you need 7 Test cases.

  • SS-S1-S2
  • S1-S2-S3
  • S1-S2-S1
  • S2-S3-S3
  • S2-S3-ES
  • S2-S1-S2
  • S3-S3-ES


I hope, with above examples its clear how 0 - Switch and 1- Switch or in general N- Switch coverage works. if in any case of any questions. Reach out to me :)

Comments

  1. Replies
    1. State Transition - Switch Coverage Explained >>>>> Download Now

      >>>>> Download Full

      State Transition - Switch Coverage Explained >>>>> Download LINK

      >>>>> Download Now

      State Transition - Switch Coverage Explained >>>>> Download Full

      >>>>> Download LINK P4

      Delete
  2. ISTQB Certification

    CSM Training
    Scrum Master certification
    ISO lead auditor certification
    ISO internal auditor certification


    Get the best ISTQB Certification Training and coaching in New Delhi. We provide the best ICAgile Certified Professional Agile Coaching in New Delhi. Contact us - (+91) 7428477227

    to get more - https://seventhhack.com/

    ReplyDelete
  3. Replies
    1. Sure, if it helps others why not. That’s the whole idea of this blog. Please go ahead.

      Delete
  4. in 1- Switch coverage , there is a test case
    s3 -> s3 -> s3

    so are there 8 test cases ?

    ReplyDelete
  5. Thanks for sharing your feedback.

    ReplyDelete

Post a Comment

Please leave your comments here