- one initial state?
- If the state-transition diagram is an open-loop, is there at least one terminal state?
- If the state-transition diagram is a closed-loop, is it really? (Almost all are actually open-loop)
- Does each state have at least one exit transition?
- If multiple guards exist for a single event, are the guards mutually exclusive?
- Does each state have exactly one transition for each possible event-guard combination?
- Have all redundant or duplicate states or transitions been removed?
- Are all states reachable?
- Is every "real" state in the world represented by one and only one state on the diagram?
- Is each state and transition clearly named?
- Are all possible paths also valid paths?
- 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?
- Are all of the required states, events, guards, transitions, and actions shown on the diagram?
- Are all exceptional cases handled properly?
- Are we using state-transition diagrams only for classes that have complex, interesting behavior?
- Does the diagram correctly represent the open-loop/closed-loop nature of the class?
- Are all of the required states, events, guards, transitions, and actions properly defined?
- Does a one-to-one correspondence exist between an object's events and its methods?
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?
- 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.