27.07.2013 Views

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Advanced Topics 235<br />

ResSetup<br />

Cancel<br />

0 ReqSetup<br />

ResSetup<br />

Cancel<br />

2<br />

ResSetup<br />

ReqSetup<br />

ReqSetup<br />

ResSetup<br />

ResSetup<br />

Cancel<br />

1<br />

Cancel<br />

ResSetup<br />

ReqSetup<br />

Cancel<br />

7<br />

4<br />

ResSetup<br />

ReqSetup<br />

ResSetup<br />

Cancel<br />

ResSetup<br />

Cancel<br />

Cancel<br />

3<br />

ReqSetup<br />

ResSetup<br />

Cancel<br />

5<br />

Cancel<br />

Cancel<br />

Cancel<br />

8<br />

Cancel<br />

Cancel<br />

6<br />

ResSetup<br />

ResSetup<br />

Figure 14.11. Composition of the cancellation model program in Figure 14.7 with the scenario in Figure<br />

14.10. Labels on transitions are abbreviated by action symbols.<br />

State variables<br />

The model program uses an enumeration CMD of commands. Each element x of CMD is<br />

used to relate an x request with an x response. The state variable cmd maps message<br />

IDs to commands.<br />

Actions<br />

Each action has a separate update rule. When the client issues a request with<br />

command X and message ID m, the update rule records that using the cmd variable.<br />

The request is enabled only if the request is not pending already. When the server<br />

responds with a message ID m, then the command in that response must be cmd[m].<br />

Notice that both the credits and the status fields are ignored in this model program.<br />

Exploration<br />

The model program is rather straigthforward in this case. It is still useful to visualize<br />

a scenario of this model program. <strong>We</strong> use the FSM in Figure 14.13. The composition<br />

of this FSM with the commands model program is shown in Figure 14.14.<br />

14.2.5 Setup feature<br />

The fourth and final feature of the protocol that we model here is the initial setup<br />

phase of the protocol. Before the protocol is initialized, the client must issue a setup<br />

request to the server and the server has to respond that the setup is completed. Once<br />

the protocol has been initialized the Setup command can no longer be issued. <strong>We</strong><br />

can model this feature as an FSM shown in Figure 14.15.<br />

Note that all fields besides the status field in the setup response are ignored<br />

in this model program. The setup model program does not include Cancel in the<br />

vocabulary.<br />

more free ebooks download links at:<br />

http://www.ebook-x.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!