Get to Know the State Transition Testing Approach and the Use of State Transition Diagram:
In a previous piece, we delved into the ‘Cause and Effect graph’ technique for composing test cases. In this article, we will explore another dynamic approach to writing test cases – the State Transition technique.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
This paper scrutinizes the expansion of this testing approach to larger programs that may not solely consist of Finite State Machines (FSMs), but have certain elements that are FSMs. This combination employs the unique ‘stateful’ and transition rules properties of the approach, resulting in a range of benefits.
State Transition Testing
The State Transition testing methodology is a Black-box testing technique valuable for testing ‘Finite State Machines’.
A ‘Finite State Machine (FSM)’ is a system that can occupy varying discrete states (such as “ready”, “not ready”, “open”, “closed”,…) depending on the inputs or stimuli it gets.
The final states a system can land in are reliant on the system’s transition standards. In simpler terms, if a system provides varied outputs for the same input, depending on its previous state, then it is a finite state system.
Moreover, if all transitions in the system are tested, this is called “0-switch” coverage. If testing encompasses 2 pairs of valid transitions, this is known as “1-switch” coverage, and the list goes on.
What You Will Learn:
Grasping the Concept of State Transition Testing Approach
The state transition approach is a dynamic testing methodology used when the system is characterized by a finite number of states and the shifts between these states abide by the system’s guidelines.
In simpler terms, this method is used when a system’s features are portrayed as states that shift into one another. These shifts are directed by the software’s regulations. The representation can be visually shown as:
Here, an entity moves or shifts from State 1 to State 2 due to some input condition, which initiates an event and leads to an action, ultimately resulting in an output.
To provide a practical example:
Picture a scenario where you go to an ATM and withdraw $1000. You receive your cash. However, when you try to withdraw another $1000, the ATM rejects the transaction due to insufficient funds. In this case, the shift or transition that led to the change in state was the previous withdrawal.
State Transition Testing Explained
Having understood what State Transition implies, we can now form a more comprehensive explanation for State Transition testing. It is a form of black-box testing in which the tester investigates the behavior of the Application Under Test (AUT) against diverse input conditions delivered in a sequence.
The system’s behavior is logged for both positive and negative test inputs.
When is State Transition Testing Useful?
State Transition testing is useful in the following situations:
- When the application under test is a real-time program with multiple states and transitions.
- When the application relies on past activities, values, or conditions.
- When it’s necessary to test the order of events.
- When the application needs to be tested with a finite set of input values.
When Should State Transition Testing Not be Used?
Avoid using State Transition testing in the following situations:
- When testing sequential input combinations is not needed.
- When different functionalities of the application need testing (similar to exploratory testing).
An Example of State Transition Testing in Software Testing
In real-life testing scenarios, testers are often provided with State Transition diagrams and are required to interpret them.
These diagrams may be issued by Business Analysts or stakeholders, and testers utilize them to create test cases.
Let’s examine the following simulation:
Software name: Manage_display_changes
Details: The software responds to input requests for changing the display mode of a time display device.
The Display mode can be configured to one of the four options:
- Two are for displaying either the time or date.
- The other two are for changing either the time or date.
The variants states are as follows:
- Change Mode (CM): Activating this alternates the display mode from “display time (T)” to “display date (D)” or vice versa.
- Reset (R): If the display mode is set to T or D, a “reset” alters it to “alter time (AT)” or “alter date (AD)” mode, respectively.
- Time Set (TS): Activating this brings the display mode back to T from AT.
- Date Set (DS): Activating this brings the display mode back to D from AD.
State Transition diagram
We can interpret it as follows:
The diagram comprises:
#1) States:
- Display Time (S1)
- Change Time (S3)
- Display Date (S2)
- Change Date (S4)
#2) Inputs:
- Change Mode (CM)
- Reset (R)
- Time Set (TS)
- Date Set (DS)
#3) Outputs:
- Alter Time (AT)
- Display Time (T)
- Display Date (D)
- Alter Date (AD)
#4) Transitions:
- Display Time (S1)
- Change Time (S3)
- Display Date (S2)
- Change Date (S4)
Step 1: Determine the initial states. Consider the number of outgoing arrows for each state.
- For State S1, there are two outgoing arrows leading to State S3 and State S2.
- For State S2, there are also two outgoing arrows, leading to State S1 and State S4.
- For State S3, there is only one outgoing arrow leading to State S1.
- For State S4, there is also only one outgoing arrow leading to State S2.
Summarize this in a table:
As State S1 and S2 have two outgoing arrows, they are listed twice.
Step 2: For each initial state, note down their final states.
<
ul>