State Transition Test case design technique is one of the testing techniques . You could find other testing techniques such as Equivalence Partitioning , Boundary Value Analysis and Decision Table Techniques by clicking on appropriate links.
Using state transition testing, we pick test cases from an application where we need to test different system transitions. We can apply this when an application gives a different output for the same input, depending on what has happened in the earlier state.
Check below video to see “State Transition Testing in Software Testing”
Some examples are Vending Machine, Traffic Lights.
Vending machine dispenses products when the proper combination of coins is deposited.
Traffic Lights will change sequence when cars are moving / waiting
Take an example of login page of an application which locks the user name after three wrong attempts of password.
A finite state system is often shown as a state diagram
It works like a truth table. First determine the states, input data and output data.
Entering correct password in the first attempt or second attempt or third attempt, user will be redirected to the home page (i.e., State – S4).
Entering incorrect correct password in the first attempt, a message will be displayed as try again and user will be redirected to state S2 for the second attempt.
Entering incorrect correct password in the second attempt, a message will be displayed as try again and user will be redirected to state S3 for the third attempt.
Entering incorrect correct password in the third attempt, user will be redirected to state S5 and a message will be displayed as “Account locked. Consult Administrator”.
Likewise, let’s see another example.
Withdrawal of money from ATM. ‘User A’ wants to withdraw 30,000 from ATM. Imagine he could take 10,000 per transaction and total balance available in the account is 25,000. In the first two attempts, he could withdraw money. Whereas in the third attempt, ATM shows a message as “Insufficient balance, contact Bank”. Same Action but due to change in the state, he couldn’t withdraw the money in the third transaction.