State-Transition Diagrams

Testing UML Models, Part 4
  1. one initial state?
  2. If the state-transition diagram is an open-loop, is there at least one terminal state?
  3. If the state-transition diagram is a closed-loop, is it really? (Almost all are actually open-loop)
  4. Does each state have at least one exit transition?
  5. If multiple guards exist for a single event, are the guards mutually exclusive?
  6. Does each state have exactly one transition for each possible event-guard combination?
  7. Have all redundant or duplicate states or transitions been removed?
  8. Are all states reachable?
  9. Is every "real" state in the world represented by one and only one state on the diagram?
  10. Is each state and transition clearly named?
  11. Are all possible paths also valid paths?
  12. Are all valid paths represented?

Domain Expert Testing
After checking the syntax of the state-transition diagrams, we proceed to the second type of testing-domain expert testing. Again, we have two options: find a domain expert or attempt to become one. (The second approach is always more difficult than the first, and the first can be very hard.) Continuing, we ask three kinds of questions: Is it complete? Is it correct? Is it consistent?


  1. Are all of the required states, events, guards, transitions, and actions shown on the diagram?
  2. Are all exceptional cases handled properly?


  1. Are we using state-transition diagrams only for classes that have complex, interesting behavior?
  2. Does the diagram correctly represent the open-loop/closed-loop nature of the class?
  3. Are all of the required states, events, guards, transitions, and actions properly defined?


  1. Does a one-to-one correspondence exist between an object's events and its methods?

Traceability Testing

Finally, after having our domain expert scour the state-transition diagrams, we proceed to the third type of testing-traceability testing. We want to make certain that we can trace from the requirements to the state-transition diagrams and from the state-transition diagrams back to the requirements. Again, we turn to one question: Is it consistent?


  1. Do all states, events, guards, transitions, and actions in the requirements appear in the state-transition diagram?

This set of questions, based on syntax, domain expert, and traceability testing; and focused on completeness, correctness, and consistency; is designed to get you started testing in an area with which you may not be familiar.

This article concludes this series on object-oriented testing. In them we've introduced you to the four most important diagrams used in object-oriented development, described the UML notation used in these diagrams, and given you a set of practical questions you can ask to evaluate the quality of these object-oriented diagrams.

I hope they have been beneficial to you.

Other articles in this series:
Use Cases: Testing UML Models, Part 1

Sequence Diagrams: Testing UML Models, Part 2

Class Diagrams: Testing UML Models, Part 3

About the author

AgileConnection is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.