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.

268 Reactive Systems<br />

refers to the part of the natural language document that specifies the condition that<br />

clients must not starve.<br />

TestResult(7, Verdict("Failure"),<br />

"Action ’ResWork(1, 0, Status(\"Completed\"))’ not enabled in the model<br />

Section ...: Client must have enough credits",<br />

Trace(<br />

ReqSetup(0, 3),<br />

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

ReqWork(1, 3),<br />

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

)<br />

)<br />

16.5 Adaptive on-the-fly testing<br />

Recall the test execution algorithm from Section 12.5.2. The top-level loop of the<br />

adaptive version of the algorithm remains the same. The algorithm RunTest that<br />

executes a single test run is extended here to handle the presence of observable<br />

actions. The outline of the algorithm is shown in Figure 16.6 and follows very<br />

closely the actual implementation in N<strong>Model</strong>. The extensions, that are emphasized<br />

in Figure 16.6, affect only a few places in the code.<br />

In the conformance tester a Boolean variable isAsync indicates if the operation<br />

mode is asynchronous. There is an additional variable called obs that is an observation<br />

queue or a queue of observable actions. The observation queue is of type<br />

TimedQueue that is defined in the N<strong>Model</strong>.Algorithms namespace. When a<br />

conformance tester is created for a given asynchronous stepper, the stepper is called<br />

with SetObserver(obs.Enqueue) to initialize the observer in the stepper with the<br />

method that enqueues actions into the observation queue.<br />

When the observation queue is nonempty, the next observation is dequeued<br />

from it and conformance to the model program is validated by using the strategy.<br />

If the observation queue is empty, a controllable (tester) action is selected using<br />

the strategy. If no tester action is enabled in the current state of the strategy, the<br />

conformance tester waits for an observable action to arrive within a time limit of<br />

obsTimeout milliseconds.<br />

16.5.1 Wait and time-out actions<br />

When the conformance tester is executed in the asynchronous mode, it uses two<br />

auxiliary actions. The wait action is an internal action that is used when there are no<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!