State Transition Testing Technique for Testing Complex Applications

In our last article, we saw ‘Cause and effect graph’ test case writing technique. Today let’s move to next dynamic test case writing method – State transition technique.

Note – The test design techniques mentioned here may seem difficult but once you get hold of it, it becomes very easy to implement and reuse, increasing productivity and test coverage.

What is State transition testing technique?

State transition technique is a dynamic testing technique, which is used when the system is defined in terms of a finite number of states and the transitions between the states are governed by the rules of the system.

Or in other words, this technique is used when features of a system are represented as states which transform to another state. The transformations are determined by the rules of the software. The pictorial representation can be shown as:

State Transition Testing 1

So here we see that an entity transitions from State 1 to State 2 because of some input condition, which leads to an event and results to an action and finally gives the output.

To explain it with an example:

You visit an ATM and withdraw $1000. You get your cash. Now you run out of balance and make exactly the same request of withdrawing $1000. This time ATM refuses to give you the money because of insufficient balance. So here the transition, which caused the change in state is the earlier withdrawal

State Transition Testing Example in Software testing:

In the practical scenario, testers are normally given the state transition diagrams and we are required to interpret it. These diagrams are either given by the Business Analysts or a stakeholder and we use these diagrams to determine our test cases.

Let’s consider the below situation:

Software name – Manage_display_changes

Specifications – The software responds to input requests to change display mode for a time display device.

The display mode can be set to one of the four values:

  • Two corresponding to displaying either the time or date.
  • The other two when altering either the time or the date.

State Transition Testing 9

The different states are as follows:

Change Mode (CM)
Activation of this shall cause the display mode to move between “display time (T)” and “display date (D)”.

Reset (R)
If the display mode is set to T or D, then a “reset” shall cause the display mode to be set to “alter time (AT)” or “alter date (AD)” modes.

Time Set (TS)
Activation of this shall cause the display mode to return to T from AT.

Date Set (DS)
Activation of this shall cause the display mode to return to D from AD.

State transition diagram is shown as:

State Transition Testing 2

Now, let’s move to interpret it:

1) Various states are:

  • Display Time(S1),
  • Change Time(S3),
  • Display Date(S2) and
  • Change Date (S4).

2) Various Inputs are:

  • Change Mode(CM),
  • Reset (R),
  • Time Set(TS),
  • Date Set(DS).

3) Various Outputs are:

  • Alter Time(AT),
  • Display Time(T),
  • Display Date(D),
  • Alter Date (AD).

4) Changed States are:

  • Display Time(S1),
  • Change Time (S3),
  • Display Date (S2) and
  • Change Date (S4).

Step 1:

Write all the start state.  For this, take one state at a time and see how many arrows are coming out from it.

  • For State S1, there are two arrows coming out of it. One arrow is going to state S3 and another arrow is going to state S2.
  • For State S2 – There are 2 arrows. One is going to State S1 and other going to S4
  • For State S3 – Only 1 arrow is coming out of it, going to state S1
  • For State S4 – Only 1 arrow is coming out of it, going to state S2

Let’s put this into our table:

State Transition Testing 3

Since for state S1 and S2 there are two arrows coming out, we have written it twice.

Step -2:

For each state, write down their final state.

  • For state S1 – The final states are S2 and S3
  • For State S2 – The final states are S1 and S4
  • For State S3 – Final state is S1
  • For State S4 – Final State is S2

Put this on the table as output / resultant state.

State Transition Testing 4

Step 3:

For each start state and its corresponding finish state, write down the input and output conditions
– For state S1 to go to state S2, the input is Change Mode (CM) and output is Display Date(D) shown below:

State Transition Testing 5

In a similar way, write down the Input conditions and its output for all the states as follows:

State Transition Testing 6

Step 4:

Now add the test case ID for each test shown below:

State Transition Testing 7

Now let’s convert it to formal test cases: 

(Click image to enlarge)

State Transition Testing 8

In this way, all the remaining test cases can be derived. I assume the other attributes of the test cases like preconditions, severity, priority, environment, build etc. are also included in the test case.


Summarizing the steps once again:

  1. Identify the initial states and their final state based on the lines/arrows that are coming out of the initial state
  2. For each initial state, find out the input condition and the output result
  3. Mark each set as a separate test case.

State Transition testing is a unique test approach for testing complex applications, which would increase test execution productivity without compromising on test coverage.

About the author: This is a guest article by Shilpa Chatterjee Roy. She is working in software testing field for the past 8.5 years in various domains.

Want more examples?

If you want more examples of State Transition Testing technique in bigger software applications, please read this post:

=> State Transition Testing Technique Example – Housing Loan Approval Application


#1 abhaya kumar

Nice article. These are advanced testing techniques we never used :( but now we realized the importance of technical testing against ad-hoc.

#2 Vidyasree

Your articles are very nice.

it was very helping to my professional life. keep on posting like this

#3 vidya

Nice article…

#4 kiran

Nice Explanation…… thank you very much

#5 Tester

Thanks for sharing such valuable articles

#6 Shilpa Chatterjee Roy

Thank you all!! Appreciate it!

#7 Sandhya

Thanku Vijay, Sending this Article

#8 Jayanthi

Very helpful keep posting……thank you

#9 Aman

it’s really sound ggood example .thanks

#10 JAI

Awesome explanation.. For a very long time I did not have a clear view about what and when to use state transition testing. Now its explained beautifully. Thanks

#11 Payilagam

Everywhere, I could observe the same ATM example for State Transition Diagram. Could you please hint anyother example for this.

#12 navaneethakrishnan

Nice article gained new points in this any other example other than loan and ATM.

#13 Zaheer

Marvellous….you make it so easy to understand it. Thank you very much for your efforts.

#14 vignesh

its easy understand the state transition concept.thank you

#15 Abdul Haq Khan

I would like to report a small Typo.
In the TC6 Output the Value should be “D” rather ‘DS’.

Please make correction in Step 3 and Step 4 Tables!
cheers :)

#16 Harish

Is it necessary to write pre and post conditions in writing Test cases.

#17 Laura Stuart

Wonderful explanation of a complex topic. You finally had this make sense to me. Thank you.

#18 mohamed ali bakr

please correct step 3 and step 4 in TC6 DS and DS and it should be DS and D , thank you and nice article

#19 ramya

Thank You So Much….

#20 Darshan Satish

Great really helpful.

#21 Jerome

great work, Thanks for posting this interesting and valuable post.

Leave a Comment