Arunkumar Khannur's Software Testing Knowledge Center

10.9. State Graph based Test Design

State Graphs provide framework for model based testing. After arriving at an executable state graph model, we execute or simulate that state graph model with event sequences as test cases. This is done before starting the actual implementation phase. This would support for testing the system implementation (program) against the system specification (State Graph) and also, support for automatic generation of test cases for the implementation. In order to design test cases we use following four steps:

  • Understanding the system
  • Identifying states, inputs and guards
  • Create a state graph model of the application
  • Verify whether State Graph that we modeled is correct in all details
  • Generate sequences of test actions

At the end of these steps, we arrive at three sets of sequences:

  • Input sequences
  • Corresponding transitions or next-state names
  • Output sequences

These steps are discussed in following sections.

10.9.1 Understanding the system

In this step, we acquire information and understand intended functionality of the system from different perspectives by involving relevant stake holders and also, analyze its environment, different users and interfaces. This activity becomes more difficult when system is of higher complexity and larger size. As such we cannot describe entire system in a model.

10.9.2 Identifying states, inputs and guards

After a basic understanding of the software’s functionality, the modelling process continues with the step that involves identifying the inputs and constructing the model.

In order to identify inputs, we have to enumerate the system inputs which include:

  • Identifying every control in the user interface or other interfaces of the system.
  • Analyzing value domains for each input that include boundaries and illegal values,
  • Analyzing and listing response of the system to the inputs
  • Observe guards which are nothing but conditions under which the inputs can be applied, and how the expected responses change depending on the condition.
  • Identifying different operational modes, i.e. states

With these activities, we arrive at a set of states, inputs and guards.

10.9.3 Create a State Graph Model of the Application

Using identified set of states, inputs and guards we can build initial state model. Here, in the model, we can observe that when the system is in a certain state, a certain set of inputs are available. When inputs are applied and guards fulfilled the system makes a transition to a different state where different inputs are available.

By refining this initial model, and also, by looking at the system from different view points, we can understand more about the purpose and functionality of the system. This will allow us to identify more inputs and states. Also, the model can be hierarchically divided into separate models, describing different levels of functionality.

However, we have to be careful in keeping the complexity of the system to a manageable limit else we may arrive at unbelievably higher number of states and transitions in the system. One technique to address this problem is abstraction where in we restrict ourselves to macro level details by avoiding details as much as possible by combining multiple states or inputs. Another technique is exclusion, where we consider important subsets of the State Graph and ignore some information in the model.
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