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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12 Technology of Test-Case Generation<br />

Levi Lúcio 1 and Marko Samer 2∗<br />

1 Software Modell<strong>in</strong>g and Verification Group<br />

University of Geneva<br />

levi.lucio@cui.unige.ch<br />

2 Institute of Information Systems<br />

Vienna University of Technology<br />

samer@dbai.tuwien.ac.at<br />

12.1 Introduction<br />

Model based test case generation deals with the generation of test cases based<br />

on test case specifications and a model of the system under test (SUT). S<strong>in</strong>ce the<br />

number of possible test cases is <strong>in</strong> general too large to be practically useful, test<br />

case specifications are used to select <strong>in</strong>terest<strong>in</strong>g test cases. Therefore, test case<br />

generation can be seen as the search problem of f<strong>in</strong>d<strong>in</strong>g appropriate test cases.<br />

In the previous chapter, several k<strong>in</strong>ds of test case specifications, <strong>in</strong> particular<br />

coverage criteria, have been presented. In the current chapter, we will show how<br />

techniques from various fields <strong>in</strong> computer science such as program analysis<br />

and formal methods can be applied to generate test cases that satisfy such<br />

specifications. The <strong>in</strong>put part of each test case can then be fed <strong>in</strong>to the SUT<br />

whose output is compared with the output part of the test case <strong>in</strong> order to<br />

detect errors. In particular, we will cover test case generation by theorem prov<strong>in</strong>g,<br />

symbolic execution, andmodel check<strong>in</strong>g. Although these techniques are often<br />

used <strong>in</strong> comb<strong>in</strong>ation, we will describe them separately <strong>in</strong> order to show their<br />

applicability and specific features from different po<strong>in</strong>ts of view.<br />

Theorem prov<strong>in</strong>g can be used to support the generation of test cases from a<br />

model that is given as formal specification. The basic assumption beh<strong>in</strong>d this<br />

approach is that the model can be partitioned <strong>in</strong>to equivalence classes which<br />

represent the same behavior with respect to the test; <strong>in</strong> particular, test data<br />

<strong>in</strong> the same equivalence class are assumed to cause the same error (or no error<br />

<strong>in</strong> the case of success). Each such equivalence class represents one test case.<br />

It is therefore sufficient to extract a small amount of test data from each test<br />

case. We will present several approaches from the literature of how to f<strong>in</strong>d such<br />

an appropriate partition<strong>in</strong>g of a given specification <strong>in</strong>to equivalence classes. In<br />

particular, we will show how general purpose theorem provers can be used to<br />

transform Z specifications <strong>in</strong>to test cases by syntactic transformations as well as<br />

by tak<strong>in</strong>g semantic aspects <strong>in</strong>to account. Moreover, we will show how Prolog can<br />

∗<br />

This author was supported by the European Community Research Tra<strong>in</strong><strong>in</strong>g Network<br />

“Games and Automata for Synthesis and Validation” (GAMES) and by the Austrian<br />

<strong>Science</strong> Fund Project Z29-N04.<br />

M. Broy et al. (Eds.): Model-Based Test<strong>in</strong>g of Reactive Systems, LNCS <strong>3472</strong>, pp. 323-354, 2005.<br />

© Spr<strong>in</strong>ger-Verlag Berl<strong>in</strong> Heidelberg 2005

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

Saved successfully!

Ooh no, something went wrong!