Black Box Testing Techniques : State Transition Testing

In previous articles we learned about Testing Techniques Overview and then Specification Based Testing Techniques or Black Box testing techniques overview.

 In this article we will learn about State Transition Testing Type

State Transition Testing Type

“A black box test design technique in which test cases are designed to execute valid and invalid state transitions.” [ISTQB glossary]

  • A state machine is a thing (e.g., system, subsystem, component, unit) whose functionality and output is dependent not solely on its current path, but also on its past input
  • The result of its previous input is called its state, and transitions are commands that cause changes from one state to another
  • State: A condition in which a system is waiting for one or more events.
  • Transition: Represents a change from one state to another caused by an event. 
  • Event: Something that causes the system to change state.
    • It can be an event in the outside world.
    • It can be an event that is generated within the system.
  • Action: Is an operation initiated because of a state change.
    • Often actions cause something to be created that are outputs of the system. 
  • State Transition Table: lists all possible state-transition combinations, not just the valid ones.
    • Critical and high risk systems require to test every state-transition pair, including those that are invalid.
    • State transition tables consist of:
      • Current state – Event - Next state - Action 

 State transition diagrams are used for:

  • Systems (or system objects) that exhibit different states at different points of time.
  • Events that come into a system and cause the system/object to change its state.
  • Valid and invalid operations and their corresponding transitions between the different states. 

How to use

  • Create the state transition diagram (if not already given) by identifying the various states, transitions between states, events that cause the transition and the actions. 
  • Create the state transition table that lists all the possible transitions and the actions corresponding to the valid transitions.
    • Number of possible transitions = (Number of states X Number of actions) less impossible transitions.
    • Impossible transitions are transitions that cannot be done by the user.
    • Impossible transitions are different from invalid transitions. 
  • Create a set of test cases such that all transitions are exercised at least once. 
  • Create test cases for some or all of the invalid state/event pairs 

When to use

  • It is suitable for system requirements that describe states and their associated transitions.
  • Workflow systems are typical candidate for this technique.