Chapter 14. State Transition Diagrams
In this chapter, I present a powerful technique for black-box testing. In some systems, the correct behavior of the system depends not only on what’s happening right now, but also on what events have occurred so far. A system that has some awareness of what has happened in the past has state-dependent behavior. State transition diagrams and state tables are powerful tools for analyzing and testing such systems. In this chapter, you’ll see how.
Describing Systems with States Using State Transition Diagrams
The process of applying state-based testing concepts to a system can be easily described.
Pick a perspective from which to view the world. This is often, but not always, the viewpoint of the system, a direct or indirect user of the system, or some real-world object that the system is aware of.
Understand the various states that the system, user, or object can be in, including the initial and final states.
Identify transitions, events, conditions, and actions that can — and can’t — apply in each state.
Use a graph or table to model the system. This graph or table also serves as an oracle to predict correct system behavior along with a requirements specification and common sense.
For each event and condition — that is, each transition — verify that the correct action and next state occurs.
While this is easily stated, the actual application of this process is tricky indeed. Let’s take a look at an example.
Figure 14-1 shows a state-transition diagram ...
Get Pragmatic Software Testing: Becoming an Effective and Efficient Test Professional now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.