# State transition testing
###### tags: `Black Box Testing Tech` `ISTQB` `Software Testing` `SQA`
systems in which **outputs are triggered** by **changes to the input conditions, or changes of ‘state’**; in other words, **behaviour depends on current state and past state, and it is the transitions that trigger system behaviour.** It will be no surprise to learn that this technique is known as state transition testing or that the main diagram used in the technique is called a state transition diagram.
#### This part has 2 symbol , 3 element
>- State
>- labelled
>- arrowhead pointing

**which is the symbol for a state.**
A state is just what it says it is: the system is ‘static’, in a stable condition from which **it will only change if it is stimulated by an event of some kind**. For example, a TV stays ‘on’ unless you turn it ‘off’; a multifunction watch tells the time unless you change mode.

<style>
.red {
color: red;
}
</style>
**which is the symbol for a transition, that is a change from one state to another.**
**<span class="red">The state change will be triggered by an event</span> (e.g. pressing a button or switching a switch).**
The transition will be labelled with the event that caused it and any action that arises from it. So we might have ‘mode button pressed’ as an event and ‘presentation changes’ as the action.
<style>
.blue {
color: blue;
}
</style>
>STATE TRANSITION DIAGRAM – EXAMPLE 4.4
A hill-walker’s watch <span class="blue">has two modes: Time and Altimeter</span>. **In Time mode, pressing the Mode switch causes the watch to switch to Alt mode; pressing Mode again returns to Time mode. While the watch is in Alt mode the Set button has no effect.**
>When the watch is in Time mode pressing the Set button transitions the watch into Set Hrs, from which the Hrs display can be incremented by pressing the Set button.
>If the Mode switch is pressed while the watch is in Set Hrs mode the watch transitions to Set Mins mode, in which pressing the Set button increments the Mins display. If the Mode button is pressed in this mode the watch transitions back to Time mode (Figure 4.1).
Note that not all events have an effect in all states. Where an event does not have an effect on a given state it is usually omitted, but it can be shown as an arrow starting from the state and returning to the same state to indicate that no transition takes place; this is sometimes known as a ‘null’ transition or an ‘invalid’ transition.

- If the event has **no effect** we label the table entry with a symbol that indicates that **nothing happens**; this is sometimes called a **‘null’ transition** or an **‘invalid’ transition**
- **Null** or **Invalid** transition: If event "No status transition" & "No action"
- If there is also an output (there is sometimes but not always) the output is indicated in the same table entry separated from the new state by the ‘/’ symbol.

- Test case 3
(Pre-condition) press Set and observe the change to Set Hrs mode
(Case) try a number of presses of Set to check that the incrementing mechanism works.
- More sophisticated: Exercise pairs of transitions
eq. Pressing Set twice as a single test case, to check that Hrs increments correctly
:::info
Exercise 4.5
In the state transition diagram in Figure 4.2, which of the sequences of transitions below would be valid?
a. ABCDE
b. FEABC
c. ABCEF
d. EFADC

:::
:::success
b FEABC
:::