State Transition Testing

It is the test design technique which help us to find out scenarios based on state transition of the software and also help us to write the effective test cases for software transition from one state to another. Means it is helpful when we want to test different state transition.

State Transition is helpful when software has finite state, not for the software which has infinite state because we can’t test all and practically it is not possible too.

Many of you might be confuse by reading above paragraph. Let’s take a small example which will help you to get idea of state transition testing.

e.g. : Take an example of fan, In case of fan there are two states one is on and another is off. See the diagram you understand in better manner.

State Transition Testing


This is state transition diagram for the fan, it has two states, ON state and OFF state which is show in circle and those lines are the transitions and the events which makes it to change its state , event mean pressing the button which can either turn on the fan or turn off the fan.

Here initially fan is off but when we press the switch then the fan changes its state from off state to on state via transition line, and when fan is ON state and we press the switch then the fan again change its state to OFF States from ON state. Here pressing the switch is an event which cause the fan to change its state.

So we can include these test cases in our test cases suit, this testing transition testing ensure to exercise all the transition of the system.

This is a small example of state transition testing let take another example.

e.g.2 : Let’s say you have to book a train ticket so that you need to visit train ticket booking website where you need to log in to your account. So we are going to draw state graph and state transition table for login.

The state graph is as shown below:

State Transition Testing for login

Note : blue transition lines specify transition when valid login details entered and red transition lines specify transition when invalid login detail entered.

So this is a state graph for the ticked booking login page, not only ticket booking login but most of the login page this state graph is valid.

So it start from entering the valid credential to get the access of the account. The first state is enter login details, second state is entering the user name and password if the user name and password are valid then user it the access of its account but if it enters wrong credential in 1ts attempt then system gives second chance to user for entering the valid login credentials. Here system changes its state as shown in image.

In 2nd attempt if user enter valid username and password then it get the access of its account if not then system gives user a 3rd attempt to enter valid credentials. In third if user again enters valid username and password then it get access to its account but if not then system again gives 4th try to the user to enter valid user name and password but in 4th attempt if user fails to provide valid credential the software get closed.

For above state graph we can draw state table. State table for above state graph is shown as follow.

State table for software testing
This is the state table explanation for this is same as the state graph.

No comments:

Post a Comment