State Transition Technique
The general meaning of state transition is, different forms of the same situation, and according to the meaning, the state transition method does the same. It is used to capture the behavior of the software application when different input values are given to the same function.
We all use the ATMs, when we withdraw money from it, it displays account details at last. Now we again do another transaction, then it again displays account details, but the details displayed after the second transaction are different from the first transaction, but both details are displayed by using the same function of the ATM. So the same function was used here but each time the output was different, this is called state transition. In the case of testing of a software application, this method tests whether the function is following state transition specifications on entering different inputs.
This applies to those types of applications that provide the specific number of attempts to access the application such as the login function of an application which gets locked after the specified number of incorrect attempts. Let’s see in detail, in the login function we use email and password, it gives a specific number of attempts to access the application, after crossing the maximum number of attempts it gets locked with an error message.
Let see in the diagram:
There is a login function of an application which provides a maximum three number of attempts, and after exceeding three attempts, it will be directed to an error page.
State transition table
STATE | LOGIN | VALIDATION | REDIRECTED |
---|---|---|---|
S1 | First Attempt | Invalid | S2 |
S2 | Second Attempt | Invalid | S3 |
S3 | Third Attempt | Invalid | S5 |
S4 | Home Page | ||
S5 | Error Page |
In the above state transition table, we see that state S1 denotes first login attempt. When the first attempt is invalid, the user will be directed to the second attempt (state S2). If the second attempt is also invalid, then the user will be directed to the third attempt (state S3). Now if the third and last attempt is invalid, then the user will be directed to the error page (state S5).
But if the third attempt is valid, then it will be directed to the homepage (state S4).
Let’s see state transition table if third attempt is valid:
STATE | LOGIN | VALIDATION | REDIRECTED |
---|---|---|---|
S1 | First Attempt | Invalid | S2 |
S2 | Second Attempt | Invalid | S3 |
S3 | Third Attempt | Valid | S4 |
S4 | Home Page | ||
S5 | Error Page |
By using the above state transition table we can perform testing of any software application. We can make a state transition table by determining desired output, and then exercise the software system to examine whether it is giving desired output or not.