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.

Advanced Topics 261<br />

Client Server<br />

ReqSetup(0,3)<br />

ResSetup(0,2,Status("Completed"))<br />

ReqWork(1,3)<br />

ReqWork(2,3)<br />

ResWork(1,1,Status("Completed"))<br />

ReqWork(3,3)<br />

ResWork(2,0,Status("Completed"))<br />

ResWork(3,0,Status("Completed"))<br />

Conformance failure!<br />

Figure 16.1. A trace of actions illustrating a conformance failure in SP. Observable actions are sent from<br />

the server to the client.<br />

Figure 16.1. After the first seven actions, the value of window in SP is the empty set<br />

and the only request that is still pending is 3. The implementation then outputs the<br />

response ResWork(3,0,Status("Completed")). This causes a conformance failure,<br />

because this action is not enabled in SP[Credits] (the model program SP with the<br />

Credits feature included).<br />

16.2 Nondeterminism<br />

Nondeterminism means here that there may be multiple possible observable actions<br />

enabled in a given model program state. Although the main emphasis of this chapter<br />

is on reactive systems, nondeterministic behavior arises also because of reasons<br />

other than reactive behavior.<br />

A common reason for nondeterminism is that the model program is written at a<br />

much higher abstraction level than the system that is being modeled. This typically<br />

means that there may be many possible IUT states corresponding to a single model<br />

program state and therefore the exact behavior of the IUT is not known in a given<br />

model program state. Usually the model program needs to be more abstract because<br />

it is a contract and there may be multiple possible implementations that conform to<br />

that contract.<br />

The implementation that is being modeled may also exhibit random behavior. This<br />

will also cause nondeterminism in the model program. The difference compared to<br />

nondeterminism due to abstraction is that the model program may be more or less<br />

at the same abstraction level as the IUT.<br />

In general, reactive behavior leads to spontaneous reactions from the IUT that<br />

need to be queued as observable actions by the conformance tester. This leads<br />

to asynchronous stepping that is the topic of Section 16.3. There is an important<br />

special case of nondeterminism, discussed next, that does not require asynchronous<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!