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.

272 Reactive Systems<br />

16.5.3 Passive testing<br />

An important special case of adaptive on-the-fly testing occurs when all the actions<br />

are observable. In that case the role of the strategy reduces to checking conformance<br />

without ever needing to select tester actions. Passive testing can be used, for example,<br />

to validate existing logs of events of a concurrent system. In that case each log<br />

represents a sequence of events produced by a single agent. Multiple per-agent<br />

event logs can be merged into a single log, for example by using the multiplexing<br />

technique discussed below.<br />

16.6 Partially ordered runs<br />

This section discusses the problem of producing a sequence of events of a reactive<br />

system, such that the sequence respects an underlying partial order of those events.<br />

If the IUT is sequential, such as a single-threaded program, events can be enqueued<br />

in the order they are observed by the stepper. This is, for example, the case<br />

with the bag example above. If the IUT is concurrent, such as a multithreaded program<br />

or a distributed system, the problem is that the chronological order in which<br />

the events are observed by the stepper and enqueued into the observation queue<br />

may differ from the chronological order in which they actually happened, due to<br />

buffering and communication delays. This may render the testing process incorrect.<br />

Dependencies between agents, where agents are either threads or processes,<br />

usually impose a partial order on the events. For example, send events happen before<br />

corresponding receive events in communicating systems. In multithreaded programs,<br />

a partial order of events is defined by access to shared resources. An example of<br />

a shared resource is a lock.<br />

Suppose that each shared resource R is associated with a usage count ucR that<br />

is initially 0. View R as a unary function symbol, and assume that each access (e.g.<br />

read or write) to R generates a resource usage event R(ucR) and causes the usage<br />

count ucR to be incremented by one.<br />

Now suppose that there are multiple agents and each agent A generates a sequence<br />

of events (eA 1 ,eA 2 ,...). Say that an event eA i happens immediately before an event<br />

, if one of the following two conditions holds:<br />

e B j<br />

1. A and B are the same agent and j = i + 1.<br />

2. A and B are distinct agents, e A i is a resource usage event R(k), and e B j is a<br />

resource usage event R(k + 1) for some shared resource R.<br />

Figure 16.7 illustrates events of a concurrent system with two agents A1 and<br />

A2. The sequence of events of an agent is shown as labeled dots along the corresponding<br />

horizontal line. An arrow from event x to event y indicates that x happens<br />

immediately before y.<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!