2 - Why We Need Model-Based Testing
Published online by Cambridge University Press: 02 March 2010
Summary
This chapter demonstrates why we need model-based testing, with a small but complete working example. We exhibit a software defect that is not detected by typical unit tests, but is only exposed by executing more realistic scenarios that resemble actual application program runs. We conclude that, in order to generate and check the realistic scenarios required for thorough testing, we will need more automation than is provided by the popular unit testing tools. We preview our testing techniques and show how they can detect the defect that the unit tests missed.
This chapter concerns testing methods. We also have analysis methods that can detect errors that arise during specification or design. We demonstrate an example that motivates our analysis methods in Chapter 3.
In this chapter, we also review some features of the technologies we use: the C# language, the .NET framework, and the NUnit testing tool.
Client and server
Suppose we are developing a laboratory instrument system comprising a temperature sensor connected to an embedded computer, a network, and another computer used for data storage and analysis (Figure 2.1). This is a client/server system. The server, a temperature-monitoring program, runs on the embedded computer. The client, a data-logging program, runs on the other computer. The programs communicate using the TCP/IP protocol, so the client could use the Internet to connect to a server in a remote factory or weather station.
First we start the server program Monitor by typing a command at the embedded computer:
Monitor 128.95.165.121 8023 1
The command-line arguments are the IP address and port number that the server should use, and the number of successive client connections to accept before exiting.
- Type
- Chapter
- Information
- Model-Based Software Testing and Analysis with C# , pp. 13 - 31Publisher: Cambridge University PressPrint publication year: 2007