Arunkumar Khannur's Software Testing Knowledge Center

12.3. State Transition Diagram

State-transition diagrams are very useful for describing the behavior of individual objects over a full set of use cases that affect those objects. STD is combination of states and transitions. In STD, the behavior of a class in object-oriented programming can be specified in terms of states and transitions that describe all of the states that an object can have and the transitions causing change in state of an object.

The properties of states and transitions are as follows:
State: A state is abstract situation in the life cycle of an object in which it satisfies some condition, performs some action, or waits for some event. It is an abstraction of a set of attribute values grouped together according to the properties that affect the gross behavior of the class. For a class, a state is a predicate on the state variables of the class.

Transition: A transition is an allowable two-state sequence, that is, a change of state (”firing”) caused by an event. For an individual object instance, a transition is composed of a source state, a target state, a method applied to that instance, A transition is composed of three items, an event, a guard, and an action.

Event: An event is a particular input that may trigger a state transition. Event types include a message or method call, an explicit signal from outside the system, an invocation from inside the system, the passage of a designated period of time, or a designated condition becoming true. It can be represented as a call to a member function of the class.

Guard: A guard is a condition that must be satisfied in order to invoke an event to cause a transition i.e. for the function call to be successful. It can be a predicate condition on any of the data attributes of the class or on any of the input parameters of the function call.

Action: Actions is the result, output or one or more operations that follow an event. Action is taken by an object in response to a state change either by referencing/manipulating the state variables of the given object or by sending messages to itself or other objects in the system. If the guard condition evaluates to TRUE, then the action is invoked.

Following diagram is a notational representation of STD:

In object oriented systems, STDs are often used for class specification. Here behavior is represented by the states of an object and the effect of the method is captured as a set of transition rules. The behavior of a component is specified by the behavior of its constituent classes.
Khannur's Book
Arunkumar Khannur, Software Testing - Techniques and Applications, Published by Pearson Publications, 2011 (ISBN:978-81-317-5836-6; Pages:341 + xxii)
Follow Khannur
Khannur's Company
ISQT Process & Consulting Services Pvt. Ltd., Bangalore, INDIA
Khannur's Software Testing Forum
 Contact Khannur
ISQT Process & Consulting Services Pvt. Ltd.
#732, 1st Floor, 12th Main,
3rd Block, Rajajinagar,
Bangalore - 560010, INDIA
Phone: +91 80 23012511
Skype: arun.isqt