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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

224 Compositional <strong>Model</strong>ing<br />

1. First, the action vocabulary is identified. Typically the action vocabulary corresponds<br />

to the set of possible value combinations of particular fields in the<br />

message header. Consider for example two fields, one that identifies whether a<br />

message is a Request or a Response, and another field that identifies a particular<br />

operation that is being performed, say a Read or a Write. The actions symbols<br />

could then be ReadRequest, ReadResponse, WriteRequest, WriteResponse.<br />

2. Second, a mapping is defined from concrete messages “on the wire” to abstract<br />

actions in the model program. This mapping may omit all fields of a message<br />

that are not used in any of the features. For example, fields that represent layout<br />

constraints on the message structure may be omitted.<br />

3. Third, a separate model program is written for each feature. The state variables<br />

of the feature model programs should be disjoint, so that independent analysis<br />

of the feature model programs is possible.<br />

4. Finally, some or all of the feature model programs, say M1,M2,...,Mk, can<br />

be composed into a model program M1 × M2 ×···×Mk to validate feature<br />

interactions or to be used as the contract during conformance testing.<br />

14.2 Motivating example: a client/server protocol<br />

<strong>We</strong> are considering a sample client/server protocol that supports various operations<br />

on shared resources across different machines. Here we are considering a fixed client<br />

and a fixed server. The sample protocol model is called SP here. There are two kinds<br />

of messages, requests and responses. All requests are initiated by the client and all<br />

responses are sent by the server. The feature model programs shown here are realistic<br />

approximations of the corresponding features described in the document. <strong>We</strong> have<br />

omitted certain details that are not relevant for explaining the ideas. The full protocol<br />

contains over 300 pages of natural language specification, and the complete model<br />

program would all in all comprise between 20 and 30 feature model programs. The<br />

following features are considered here:<br />

• Credits feature is a variation of the sliding window algorithm (Section 14.2.1,<br />

below) that enables the client and the server to maintain a consistent view of<br />

which message IDs are used.<br />

• Cancellation feature enables prior requests from the client to be cancelled later<br />

by the client.<br />

• Commands feature ensures that response messages from the server match with<br />

respect to the particular commands being requested by the client.<br />

• Setup feature is a handshake between the client and the server that activates the<br />

protocol.<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!