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.

116 Structuring <strong>Model</strong> Programs with Features and Composition<br />

15<br />

ClientSend()<br />

ServerCloseConnection()<br />

25<br />

21<br />

ServerClose()<br />

28<br />

3<br />

ServerClose()<br />

29<br />

2<br />

0<br />

ServerSocket() ClientSocket()<br />

ServerBind() ClientSocket() ServerSocket()<br />

5<br />

ServerClose() 6<br />

7<br />

ClientSocket() ClientConnect()<br />

11<br />

ServerListen()<br />

10<br />

ServerClose()<br />

ServerReceive() ServerSend(double("100"))<br />

17<br />

ServerCloseConnection()<br />

ServerClose() ClientReceive_Start()<br />

23<br />

24<br />

ClientReceive_Start()<br />

22<br />

13<br />

12<br />

ClientSocket()<br />

8<br />

ServerAccept()<br />

18<br />

ClientSend() ServerClose()<br />

26<br />

27<br />

1<br />

4<br />

ServerListen()<br />

ServerBind()<br />

ServerClose()<br />

ClientReceive_Finish(double("100"))<br />

ClientReceive_Start() ClientReceive_Finish(double("100")) ClientReceive_Finish(double("99.9"))<br />

ClientReceive_Finish(double("100"))<br />

Figure 7.1. Client/server: true FSM.<br />

ServerClose() ClientSocket()<br />

31<br />

ClientReceive_Start()<br />

9<br />

ServerClose()<br />

ServerSend(double("99.9"))<br />

16<br />

ServerClose()<br />

ServerCloseConnection() ClientReceive_Start()<br />

ClientClose()<br />

20<br />

ClientSend() ClientClose() ServerClose()<br />

ServerClose()<br />

30<br />

32<br />

19<br />

ClientReceive_Start()<br />

ClientReceive_Finish(double("99.9"))<br />

ClientReceive_Finish(double("99.9"))<br />

ServerCloseConnection()<br />

ClientClose()<br />

14<br />

ServerCloseConnection()<br />

and Listen, and the client executes Socket. There are several runs where the client<br />

Socket action is interleaved between different server actions. <strong>We</strong> know that all of<br />

these runs have to be equivalent because the client and server do not even begin to<br />

interact until the client’s Connect action. Before that, the order of the interleaving<br />

of client and server actions cannot make any difference. Indeed, all of these runs<br />

reach the same state. There are several other runs where the server executes Close<br />

before the client connects. Nothing interesting can happen after that, so these runs<br />

end in dead states. In the usual case where we want to see what happens after the<br />

client and server connect, we could replace all of the runs in Figure 7.2 by a single<br />

run without losing any useful information.<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!