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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

242 Compositional <strong>Model</strong>ing<br />

placeholders. <strong>We</strong> say that an action or a trace is concrete when it has no placeholders.<br />

If a trace of a model program has placeholders, then any instance of it is a trace of<br />

that model program as well, because a placeholder indicates that the corresponding<br />

argument has no behavioral significance with respect to this model program.<br />

For example,<br />

ReqSetup(),ResSetup(_,_,STATUS("Completed")),ReqWork()<br />

is a trace of the setup model program, whereas<br />

ReqSetup(),ResSetup(),ReqWork()<br />

is not, because the following instance of it is not a trace of the setup model program.<br />

ReqSetup(),ResSetup(_,_,Status("Cancelled")),ReqWork()<br />

Two traces match if they have a common instance. Notice that two traces that<br />

have no placeholders match if and only if they are equal. For example, the trace<br />

ReqSetup(1,2),ResSetup(1,_,Status("Completed")),ReqWork(_,3)<br />

is an instance 2 of the trace<br />

ReqSetup(1),ResSetup(_,_,Status("Completed")),ReqWork()<br />

as well as the trace<br />

ReqSetup(_,2),ResSetup(1),ReqWork(_,3)<br />

Notice that none of the above traces are concrete.<br />

14.3.1 Trace intersection<br />

A desired property of M1 × M2 is that the set of all traces of M1 × M2 is the<br />

intersection of the set of all traces of the loop extension of M1 for A2, say M ′ 1 , and<br />

the set of traces of the loop extension of M2 for A1, say M ′ 2 . A reason why this<br />

property is important is that it makes it possible to do compositional reasoning over<br />

the traces in the following sense. If all traces of M ′ 1 satisfy a property p and all<br />

traces of M ′ 2 satisfy a property q, then all traces of M1 × M2 satisfy both properties<br />

p and q. A sufficient condition for the trace intersection property to be true is if M1<br />

and M2 don’t share any state variables.<br />

Let M1 be the setup model program in Figure 14.15 and let M2 be the cancellation<br />

model program in Figure 14.7. First, let us see how the model program M1 × M2 is<br />

constructed. The state variables of M1 × M2 is the union of the state variables of M1<br />

and M2. Let us call the state variable of M1 setupMode that may take one of the three<br />

2 It is in fact the most general common instance of both traces; i.e., any other instance of both<br />

traces is also an instance of the most general common instance.<br />

more free ebooks download links at:<br />

http://www.ebook-x.com

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

Saved successfully!

Ooh no, something went wrong!