07.01.2013 Views

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

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.

282 Alexander Pretschner and Jan Philipps<br />

Test case specification<br />

Model<br />

Test cases<br />

Validation<br />

γ/α<br />

Verification<br />

Fig. 10.1. Model-Based Test<strong>in</strong>g<br />

Code<br />

HW, OS, Legacy<br />

implementation corresponds to the model, or to prove that it does not. Test<strong>in</strong>g<br />

is hence an activity of verification: the implementation is checked for correctness<br />

w.r.t. the model which can arguably be <strong>in</strong>terpreted as a behavior specification,<br />

and which represents the formalized user requirements.<br />

This approach immediately raises an array of difficult questions. The issues of<br />

test case specifications and generation technology are treated <strong>in</strong> Chapters 11 and<br />

12 of this book, and are consequently not the subject of this chapter. Instead,<br />

we focus on the follow<strong>in</strong>g two key questions.<br />

(1) Obviously, <strong>in</strong> the above approach, the model has to faithfully represent the<br />

user requirements, i.e., the <strong>in</strong>tended behavior: it has to be valid. Why would<br />

one choose to build a costly model, validate it, derive tests and run them on<br />

a SUT rather than directly validate the SUT?<br />

(2) Because system and software construction occur—as any eng<strong>in</strong>eer<strong>in</strong>g<br />

activity—under high time and cost constra<strong>in</strong>ts, can we build a s<strong>in</strong>gle model<br />

to generate both test cases and production code?<br />

The first question is answered by requir<strong>in</strong>g models to be more abstract, or<br />

“simpler”, than the SUT. Because they are more abstract, they are easier to<br />

understand, validate, ma<strong>in</strong>ta<strong>in</strong>, and more likely to be amenable to test case generation.<br />

The above approach to model-based test<strong>in</strong>g is then modified as follows.<br />

The <strong>in</strong>put part of a model’s trace—the test case—is concretized (γ <strong>in</strong> the figure)<br />

before it is fed <strong>in</strong>to the implementation. Conversely, the output of the SUT is<br />

abstracted (α <strong>in</strong> the figure) before it is compared to the output of the model.<br />

Note that this approach <strong>in</strong>curs a cost: aspects of the SUT that were abstracted<br />

away can obviously not directly be tested on the grounds of the abstract model.<br />

The second question will be answered by discuss<strong>in</strong>g different scenarios of<br />

model-based test<strong>in</strong>g that regard different <strong>in</strong>terleav<strong>in</strong>gs and flavors of build<strong>in</strong>g<br />

models and code. Roughly, it will turn out that some sort of redundancy is<br />

<strong>in</strong>dispensable: choos<strong>in</strong>g to derive both test cases and implementations from one<br />

s<strong>in</strong>gle model requires one to precisely know what this means <strong>in</strong> terms of quality<br />

assurance: <strong>in</strong> this way, code generators and assumptions on the environment can<br />

be tested.

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

Saved successfully!

Ooh no, something went wrong!