Features
We will model all of the features of the implementation client and server classes
(Chapter 2, Section 2.4). Usually, a model program only represents some of the
features of the implementation. But for this example we selected a very small
implementation, so we could show the complete implentation and write a complete
model program.
Actions
We plan to generate test runs that call the methods of the implementation, so there
must be an action in the model for each public method in the implementation. The
client and server actions are distinct; the client??™s send is a different action from the
server??™s send, so we have actions ClientSend and ServerSend, and so on.
Traces
We write some sample traces to make sure that the actions we chose can express the
behaviors we wish to model. There are many examples in Chapter 2. For example,
the run discussed in Section 2.8, which is coded in the test method in Figure 2.10,
is expressed by this trace:
ServerSocket();
ServerBind();
ServerListen();
ClientSocket();
ClientConnect();
ServerAccept();
ClientSend();
ServerReceive();
74 Model Programs
ServerSend(212.0);
ClientReceive(); // should return 212.0
ClientClose();
ServerCloseConnection();
ServerClose();
Here server.Socket in the implementation is modeled by ServerSocket in the
model program, and so on. The arguments of Bind, Connect, and the client??™s Send
in the implementation are not needed in the model program.
Pages:
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120