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.
Objectives of State Transition Testing:
The objective of State Transition testing is:
To test the behavior of the system under varying input.
To test the dependency on the values in the past.
To test the change in the transition state of the application.
To test the performance of the system.
Transition States:
Change Mode: When this mode is activated, the display mode moves from TIME to DATE.
Reset: When the display mode is TIME or DATE, reset mode sets them to ALTER TIME or ALTER DATE, respectively.
Time Set: When this mode is activated, the display mode changes from ALTER TIME to TIME.
Date Set: When this mode is activated, the display mode changes from ALTER DATE to DATE.
State Transition Diagram:
State Transition Diagram shows how the system’s state changes on specific inputs.
It has four main components:
States
Transition
Events
Actions
Advantages of State Transition Testing:
State transition testing helps in understanding the behavior of the system.
State transition testing gives the proper representation of the system behavior.
State transition testing covers all the conditions.
Disadvantages of State Transition Testing:
State transition testing can only be performed in some places.
State transition testing is only sometimes reliable.