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.

12 <strong>Testing</strong> Systems<br />

with Complex State<br />

This chapter discusses various approaches to on-the-fly testing of closed systems.<br />

(<strong>We</strong> discuss on-the-fly testing of reactive systems in Chapter 16.)<br />

The main difference between on-the-fly testing and offline testing is that in the<br />

case of on-the-fly testing, action sequences are not known beforehand; that is, there<br />

is no pregenerated test suite.<br />

The use of on-the-fly testing is most relevant when the state space of the model<br />

is too large to be covered comprehensively. It may still be possible to use various<br />

finitization techniques discussed in earlier chapters to cope with this problem; onthe-fly<br />

testing is an alternative approach that may be more suitable in some situations,<br />

for example, when existence of a test suite is not relevant, or when it is not clear<br />

how to finitize or abstract the model.<br />

Another case when on-the-fly testing is useful is when implementation under test<br />

(IUT) has hidden states that are not distinguished by the model. In other words, if a<br />

state is revisited in the model, the corresponding state in the implementation may be<br />

new. In such a case a test suite that provides transition coverage of the model might<br />

not expose an error because a transition in the model has to be traversed multiple<br />

times before the IUT is in a state where the error occurs. The error discussed in<br />

Chapter 2 is an example.<br />

The key concept of on-the-fly testing is a strategy. Intuitively, a strategy is a<br />

function that during each step of testing selects which action to apply next. A strategy<br />

may be very cheap; for example, it may make a random choice of what action<br />

to take, or it may be very expensive and try to compute the best possible choice<br />

according to some optimization criterion. A strategy can use additional memory<br />

besides the model state to record prior action selection history, or it can be memoryless<br />

and forget prior choices. Strategies can use coverage points to help exercise<br />

the implementation thoroughly. There is a whole spectrum of possible strategies.<br />

<strong>We</strong> illustrate how one can use the basic strategy that is supported by the library and<br />

how one can define customized strategies for on-the-fly testing.<br />

more free ebooks download links at:<br />

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

191

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

Saved successfully!

Ooh no, something went wrong!