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.

12 Technology of Test-Case Generation 327<br />

represents the value after the application of Increment. 2 This allows us to def<strong>in</strong>e<br />

the effect of the operation Increment on Counter <strong>in</strong> the predicate part. In particular,<br />

if the value of ctr is less than three, then its value after the application<br />

of Increment must be ctr +1, and if ctr is equal to three, then its value after<br />

application of Increment must be zero.<br />

F<strong>in</strong>ally, let us specify another example: the modulo operation of natural<br />

numbers which, given the base and the modulus, returns the common residue.<br />

Modulo<br />

b?, m?, r! :N<br />

b? ≥ m?<br />

(r! < m?) ∨ (m? =0)<br />

∃ k : N • b? =m? ∗ k + r!<br />

This schema declares the three variables b?, m?, and r! to be natural numbers.<br />

The suffixes ‘?’ and ‘!’ <strong>in</strong>dicate <strong>in</strong>put and output parameters respectively.<br />

The predicate part consists of three predicates. The first ensures that the base<br />

must be greater or equal to the modulus. The second ensures that the specified<br />

residue is the common residue, i.e., less than the modulus, or that the modulus<br />

is equal to zero. In the latter case, the residue should be equal to the base which<br />

is greater or equal to the modulus accord<strong>in</strong>g to the first predicate. The f<strong>in</strong>al<br />

predicate specifies the relationship between base, modulus, and residue.<br />

As already mentioned, the above constructs represent only a small fraction<br />

of the whole Z specification language. The reader is referred to [Spi92, PST96,<br />

ISO02] for a more exhaustive <strong>in</strong>troduction to Z. We will use Z specifications as<br />

the basis of test case generation <strong>in</strong> the follow<strong>in</strong>g section.<br />

12.2.2 Test Case Generation from Z Specifications<br />

Given a model of the SUT as Z specification, general purpose theorem provers<br />

can be used to support the partition<strong>in</strong>g of the specification <strong>in</strong>to equivalence<br />

classes. We will now present some approaches of how to construct test cases<br />

from Z specifications <strong>in</strong> such a way. We start with the disjunctive normal form<br />

approach, a method that allows us to syntactically transform Z specifications <strong>in</strong>to<br />

equivalence classes. Afterwards, we present the classification-tree method which<br />

enables us to <strong>in</strong>tegrate semantic aspects <strong>in</strong>to the partition<strong>in</strong>g process. F<strong>in</strong>ally,<br />

we discuss partition<strong>in</strong>g heuristics which can be seen as a general theoretical<br />

framework of syntactic and semantic partition<strong>in</strong>g methods.<br />

The Disjunctive Normal Form Approach. In the approach of Helke et<br />

al. [HNS97], Z specifications are translated <strong>in</strong>to the <strong>in</strong>put language of Isabelle<br />

2 Similarly, a preced<strong>in</strong>g symbol Ξ <strong>in</strong>dicates an implicit declaration of the variables<br />

of Counter which, <strong>in</strong> contrast to ∆, rema<strong>in</strong> unchanged, that is ctr ′ = ctr.

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

Saved successfully!

Ooh no, something went wrong!