written 5.2 years ago by |
Tables are useful tools for representing and documenting many types of information relating to test case design. These are beneficial for the applications; which can be described using state transition diagrams and state tables. First we define some basic terms related to state tables,
1. Finite State Machine
A finite state machine (FSM) is a behavioral model whose outcome depends upon both previous and current inputs. FSM models can be prepared for software structure or software behavior and it can be used as a tool for functional testing. Many testers prefer to use FSM model as a guide to design functional tests.
2. State Transition Diagrams or State Graph
A system or its components may have a number of states depending on its input and time. For example, a task in an operating system can have the following states:
New State: When a task is newly created
Ready: When the task is waiting in the ready queue for its turn
Running: When instructions of the task are being executed by CPU
Waiting: When the task is waiting for an I/O event or reception of a signal
Terminated The task has finished execution
States are represented by nodes. Now with the help of nodes and transition links between the nodes, a state transition diagram or state graph is prepared. A state graph is the pictorial representation of an FSM. Its purpose is to depict the states that a system or its components can assume. It shows the events or circumstances that cause or result from a change from one state to another.
Whatever is being modelled is subjected to inputs. As a result of these inputs, when one state is changed to another, it is called a transition. Transitions are represented by links that join the nodes. The state graph of task states is shown in Fig.1.
Each arrow link provides two types of information:
- Transition events such as admitted, dispatch, and interrupt
- The resulting output from states such as $\mathrm{T} 1, \mathrm{T} 2,$ and $\mathrm{T} 3$ .
$\mathrm{T} 0=$ Task is in new state and waiting for admission to ready queue
$\mathrm{T} 1=$ A new task admitted to ready queue
$\mathrm{T} 2=$ A ready task has started running
$\mathrm{T} 3=$ Running task has been interrupted
$\mathrm{T} 4=$ Running task is waiting for I/O or event
$\mathrm{T} 5=$ Wait period of waiting task is over
$\mathrm{T} 6=$ Task has completed execution
3. State Table
State graphs of larger systems may not be easy to understand. Therefore, state graphs are converted into tabular form for convenience sake, which are known as state tables. State tables also specify states, inputs, transitions, and outputs. The following conventions are used for state table:
- Each row of the table corresponds to a state.
- Each column corresponds to an input condition.
- The box at the intersection of a row and a column specifies the next state (transition) and the output, if any.
The state table for task states is given in below table.
The highlighted cells of the table are valid inputs causing a change of state. Other cells are invalid inputs, which do not cause any transition in the state of a task.
4. State Table-Based Testing
After reviewing the basics, we can start functional testing with state tables. A state graph and its companion state table contain information that is converted into test cases.