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.

5 <strong>Model</strong> Programs<br />

This chapter introduces model programs. <strong>We</strong> show how to code model programs<br />

that work with the tools, by using attributes from the modeling library along with<br />

some coding conventions.<br />

In this chaper we also explain the process of writing a model program: the<br />

steps you must go through to understand the implementation and design the model<br />

program. Writing a model program does not mean writing the implementation twice.<br />

By focusing on the purpose of the model, you can write a model program that is<br />

much smaller and simpler than the implementation, but still expresses the features<br />

you want to test or analyze.<br />

Here in Part II, we explain modeling, analysis, and testing with finite model<br />

programs that can be analyzed exhaustively (completely). The programs and systems<br />

we model here are “infinite” – perhaps not mathematically infinite, but too large to<br />

analyze exhaustively. One of the themes of this chapter is how to finitize (make<br />

finite) the model of an “infinite” system. Starting in Part III, the model programs are<br />

also “infinite”; we finitize the analysis instead.<br />

In this chapter we develop and explain three model programs: a newsreader<br />

user interface, the client/server system of Chapter 2, and the reactive system of<br />

Chapter 3. <strong>We</strong> will perform safety and liveness analyses of the reactive system<br />

model in Chapter 6. <strong>We</strong> will generate and check tests of the implementation using<br />

the client/server model in Chapter 8.<br />

5.1 States, actions, and behavior<br />

First we must define some basic concepts and vocabulary. <strong>We</strong> will demonstrate these<br />

concepts in the sections that follow.<br />

A model program is a program that describes the behavior of another program or<br />

system called the implementation. <strong>We</strong> say system here because the implementation<br />

need not be a single program. A single model program can represent a concurrent<br />

more free ebooks download links at:<br />

http://www.ebook-x.com<br />

57

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

Saved successfully!

Ooh no, something went wrong!