State Transition Testing
Introduction
State Transition testing is a Black-box testing technique,
which can be applied to test ‘Finite State Machines’.
A ‘Finite State Machine (FSM)’ is a system that will be in
different discrete states (like “ready”, “not ready”,
“open”, “closed”,…) depending on the inputs or stimuli.
The discrete states that the system ends up with,
depends on the rules of the transition of the system.
That is, if a system gives a different output for the same
input, depending on its earlier state, then it is a finite
state system.
Cont...
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 into one another. The transformations are
determined by the rules of the software. The
pictorial representation can be shown as:
Example 1
Loginpage of a software which locks the
user name after three wrong attempts of
password.
Example 1
Example 1 : Valid transitions
Example 1 : Invalid transitions
Example 2
When to use State Transition Testing?
When the application under test is a real-time
system with different states and transitions
encompassed.
When the application is dependent upon the
event/values/conditions of the past.
When the sequence of events needs to be
tested.
When the application needs to be tested
against a finite set of input values.
When not to use State Transition
Testing?
When testing is not required for sequential
input combinations.
When different functionalities of the
application are required to be tested (more
like Exploratory testing).
A detailed Example
Example 3
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.
Example 3 : Different modes
The different modes 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.
Example 3 : Cont.…
#1) Various States are: #3) Various Outputs
Display Time(S1), are:
Change Time(S3), Alter Time(AT),
Display Date(S2), and Display Time(T),
Change Date (S4). Display Date(D),
#2) Various Inputs are: Alter Date (AD).
Change Mode(CM),
Reset (R),
Time Set(TS),
Date Set(DS).
Example 3 : Cont.…
Step 1: Write all of the start states.
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
Example 3 : Cont.…
Step -2: For each state, write down their final
transitioned states.
For state S1 – The final states are S2 and S3
For State S2 – The final states are S1 and S4
For State S3 – The final state is S1
For State S4 – Final State is S2
Example 3 : Cont.…
Step 3: For each start state and its
corresponding finish state, write down the
input and output conditions
Example 3 : Cont.…
Step 4:
Now add the test case ID for each test
shown below:
Example 3 : Cont.…
Now let’s convert it to formal test cases:
Example 3 : Cont.…
In this way, all the remaining test cases can
be derived.
Summarizing the steps once again:
Identify the initial states and their final state
based on the lines/arrows that are coming
out of the initial state.
For each initial state, find out the input
condition and the output result
Mark each set as a separate test case.
References
https://www.youtube.com/watch?v=4ie2C12
LBXg
https://www.softwaretestinghelp.com/state-t
ransition-testing-technique-for-testing-comp
lex-applications/