Arunkumar Khannur's Software Testing Knowledge Center
   
 

10.3. State Graph

State Graphs are very useful for describing the behaviour of individual objects over a full set of use cases that affect those objects. State Graph is a combination of states and transitions. In a State Graph, the behaviour 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:

10.3.1 State

A state is an 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 behaviour of the class. For a class, a state is a predicate on the state variables of the class.

10.3.2 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, and a method applied to that instance. A transition is composed of three items, an event, a guard, and an action.

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

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

10.3.5 Outputs or Actions

Output or action is the result, 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 State Graph:

In object oriented systems, State Graphs are often used for class specification. Here behaviour is represented by the states of an object and the effect of the method which is captured as a set of transition rules. The behaviour of a component is specified by the behaviour 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
STEP-AUTO Forum
 Contact Khannur
ISQT Process & Consulting Services Pvt. Ltd.
#732, 1st Floor, 12th Main,
3rd Block, Rajajinagar,
Bangalore - 560010, INDIA
Phone: +91 80 23012511
URL: www.isqtinternational.com
Email: khannur@isqtinternational.com
Skype: arun.isqt