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.

260 Reactive Systems<br />

what part of its behavior is being controlled. Therefore, this distinction is mostly<br />

relevant in the context of generating and executing tests. For ct the option that is<br />

used to declare an action symbol observable is observable (or o for short).<br />

A typical example of an observable action is a response from the server in a<br />

client/server protocol model, assuming that the server is being tested for conformance<br />

and the behavior of the client is being controlled by the tester. Consider, for<br />

example, the model program SP in Chapter 14 and suppose that you want to test that<br />

a server conforms to SP. In this case all the responses from the server are observable<br />

actions; that is, the actions whose symbol is either ResSetup or ResWork.<br />

16.1.1 Conformance relation<br />

Given is a model program MP and an implementation under test IUT, and the question<br />

under consideration is whether IUT conforms to MP. What does that mean?<br />

There are two ways to answer this question. The first one is declarative; the explanation<br />

is in terms of action traces. The second one is operational; the explanation<br />

is in terms of executing actions in MP and IUT.<br />

Declarative view. The intuition behind this view is what constitutes a failure or a<br />

witness of a conformance violation. MP and IUT do not conform if there exists a<br />

trace of actions that is allowed in both MP and IUT, and after executing that trace<br />

in MP and IUT, either there is a controllable action that is allowed in MP but not<br />

allowed in IUT, or there is an observable action that is allowed in IUT, but not<br />

allowed in MP. In other words, after a sequence of actions which both MP and IUT<br />

agree upon, either there is a controllable action that causes the IUT to throw an<br />

exception, or there is an observable action output by the IUT that causes an enabling<br />

condition violation in MP.<br />

Operational view. The intuition behind this view is how to implement a conformance<br />

tester that detects failures in the above sense. Let SMP stand for the current<br />

state of the MP and let SIUT stand for the current state of the IUT.SayMP and IUT<br />

conform from SMP and SIUT if the following two conditions hold:<br />

• If there is a controllable action a that is allowed in SMP, then a must be allowed<br />

in SIUT , and MP and IUT must conform from the states after executing a.<br />

• If there is an observable action a that is allowed in SIUT , then a must be allowed<br />

in SMP, and MP and IUT must conform from the states after executing a.<br />

MP and IUT conform, if they conform from the initial states.<br />

Example. Consider the model program SP from Chapter 14 and a server implementation<br />

that may sometimes grant too few credits to the client. In Section 16.3 a mock<br />

implementation of the server is illustrated that has such a bug. Consider the trace in<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!