State transition testing is used for systems where some aspect of the software system can be described in ‘finite state machine’. This means that the system can be in a finite number of different states, and the transitions from one state to another are determined by the rules of the ‘machine’.

What is a finite State System

Any system where you get a different output for the same input, depending on what has happened before, is a finite state system. A finite state system is often shown as a state diagram.

Let us take an example to explain this in detail:

Suppose you want to withdraw $500 from a bank ATM, you may be given cash. After some time you again try to withdraw $500 but you may be refused the money (because your account balance is insufficient). This refusal is because your bank account state has changed from having sufficient funds to cover withdrawal to having insufficient funds. The transaction that caused your account to change its state was probably the earlier withdrawal. A state diagram can represent a model from the point of view of the system or the customer.

A state transition model has four basic parts:

1. The states that the software may occupy (funded/insufficient funds)
2. The transitions from one state to another (all transitions are not allowed)
3. The events that cause a transition (like withdrawing money)
4. The actions that result from a transition (an error message or being given your cash)

Please note that in any given state, one event can cause only one action, but that the same event from a different state may cause a different action and a different end state.