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.

270 Reactive Systems<br />

tester actions enabled and when the observation queue is empty. The default name<br />

of a wait action is "Wait", which can be customized using the waitAction option<br />

of ct. A wait action takes one integer argument that specifies the amount of time<br />

in milliseconds, called an observation time-out. The conformance tester uses the<br />

observation time-out to wait for an observable action to arrive.<br />

The simplest way to define a state independent wait action is to use a finite state<br />

machine (FSM) model program and to compose it with the main model program.<br />

The following FSM, say Wait20, specifies a 20-ms observation time-out:<br />

FSM(0,AcceptingStates(0),Transitions(t(0,Wait(20),0)))<br />

The time-out action is an observable action without arguments. It happens if<br />

the observation queue is empty after executing a wait action. This results in a<br />

conformance failure, unless the time-out action is enabled in the model program.<br />

The default name of the time-out action is "Timeout", which can be customized using<br />

the timeoutAction option of ct.<br />

To see the effect of the wait and time-out actions, execute ct with the above<br />

arguments and add the option /fsm:Wait20 in order to compose the main model<br />

program with Wait20. The following is a possible output from this execution:<br />

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

"Action symbol ’Timeout’ not enabled in the model",<br />

Trace(<br />

ReqSetup(0, 3),<br />

Wait(20),<br />

Time-Out()<br />

)<br />

)<br />

Reset failed.<br />

The specified observation timeout is too small. After the first test case fails, reset<br />

also fails because the implementation is still busy. (See the defintion of Reset in<br />

Figure 16.5.)<br />

16.5.2 Adaptive strategies<br />

Recall the discussion on strategies from Chapter 12. All the techiques discussed<br />

there apply in the presence of observable actions as well. For example, execution of<br />

ct in the previous section used the default strategy that selects controllable actions<br />

randomly.<br />

With observable actions one can do more. Note that each time an observable<br />

action is consumed in the algorithm in Figure 16.6 the strategy is told to execute that<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!