O'Reilly logo

Pragmatic Software Testing: Becoming an Effective and Efficient Test Professional by Black, Rex, Rex Black Consulting Services, Bulverde, Texas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

  1. 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.

  2. Understand the various states that the system, user, or object can be in, including the initial and final states.

  3. Identify transitions, events, conditions, and actions that can — and can’t — apply in each state.

  4. 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.

  5. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required