FINITE-STATE MACHINE
10.3 FINITE-STATE MACHINE
A FSM M is defined as a tuple as follows: M = <S, I, O, s 0 , δ, λ> , where S is a set of states,
I is a set of inputs, O is a set of outputs,
271 s 0 is the initial state,
10.3 FINITE-STATE MACHINE
δ : S × I → S is a next-state function, and λ : S × I → O is an output function.
Note the following points related to inputs and outputs because of the impor- tance of the concept of observation in testing a system:
• Identify the inputs and the outputs which are observed by explicitly spec- ifying a set of PCOs. For each state transition, specify the PCO at which
the input occurs and the output is observed. • There may be many outputs occurring at different PCOs for a single input
in a state. An FSM specification of the interactions between a user and a PBX system is
shown in Figure 10.8. The FSM has nine distinct states as explained in Table 10.2.
OH
LP: ONH/ -
LP: OFH/ LP: DT AD
LP: #1/ LP: RT, LP: #2/ LP: SBT
LP: ONH/ - LP: ONH/ -
RP: RING
SB
RNG
LP: NOI/
LP: NOI/ LP: FBT
LP: FBT
RP: OFH/ LP: IT, RP: IT FB LP: ONH/ -
RP: NOI/ FBT TK
LP: NOI/ LP: IT
RP: OFH/ -
LP: ONH/ RP: IT LP: OFH/ LP: IT
LP: NOI/ LP: DT LON
RP: ONH/ LP: IT
IAF LP: NOI/ -
RON
RP: ONH/ -
LP: ONH/ -
LP: ONH/ -
OH
Figure 10.8 FSM model of PBX.
272 CHAPTER 10 TEST GENERATION FROM FSM MODELS
TABLE 10.2 Set of States in FSM of Figure 10.8 Abbreviation
Expanded Form Meaning OH
On hook A phone is on hook. AD Add digit
The user is dialing a number. SB
Slow busy The system has produced a slow busy tone. FB Slow busy
The system has produced a fast busy tone. RNG
Ring The remote phone is ringing. TK
Talk A connection is established. LON
Local on hook The local phone is on hook. RON
Remote on hook The remote phone is on hook. IAF
Idle after Fast busy The local phone is idle after a fast busy.
TABLE 10.3 Input and Output Sets in FSM of Figure 10.8 Input
Output
OFH: Off hook
DT: Dial tone
ONH: On hook
RING: Phone ringing
#1: Valid phone number
RT: Ring tone
#2: Invalid phone number
SBT: Slow busy tone
NOI: No input
FBT: Fast busy tone IT: Idle tone
—: Don’t care
The initial state of the FSM is OH, which appears twice in Figure 10.8, because we wanted to avoid drawing transition lines from states LON, RON, and IAF back to the first occurrence of OH at the top.
There are five distinct input symbols (Table 10.3) accepted by the FSM. NOI represents user inaction; that is, the user never provides an input in a certain state. We have introduced the concept of an explicit NOI because we want to describe the behavior of a system without introducing internal events, such as timeouts. There are seven output symbols, one of which denotes a don’t care output. A don’t care output is an absence of output or an arbitrary output which is ignored by the user.
There are two abstract PCOs used in the FSM of Figure 10.8. These are called LP and RP to represent a local phone used by a caller and a remote phone represented by the callee, respectively. We call LP and RP abstract PCOs because each LP and RP represents five real, distinct PCOs, as explained in Section 10.2.
The input and output parts of a state transition are represented as follows:
PCO i :a PCO j :b
273 where input a occurs at PCO i and output b occurs at PCO j . If a state transition
10.5 TRANSITION TOUR METHOD
produces multiple outputs, we use the notation
PCO i :a {PCO j : b, PCO k : c}
where input a occurs at PCO i , output b occurs at PCO j , and output c occurs at PCO k . We will represent a complete transition using the following syntax:
< present state, input, output, next state> or <present state, input/output, next state>
The state transition <OH, LP: OFH, LP: DT, AD> means that if the FSM is in state OH and receives input OFH (off hook) at port (PCO) LP, it produces output DT (dial tone) at the same port LP and moves to state AD (Figure 10.8).