5.2. The top-level loop of the
adaptive version of the algorithm remains the same. The algorithm RunTest that
executes a single test run is extended here to handle the presence of observable
actions. The outline of the algorithm is shown in Figure 16.6 and follows very
closely the actual implementation in NModel. The extensions, that are emphasized
in Figure 16.6, affect only a few places in the code.
In the conformance tester a Boolean variable isAsync indicates if the operation
mode is asynchronous. There is an additional variable called obs that is an observation
queue or a queue of observable actions. The observation queue is of type
TimedQueue
that is defined in the NModel.Algorithms namespace. When a
conformance tester is created for a given asynchronous stepper, the stepper is called
with SetObserver(obs.Enqueue) to initialize the observer in the stepper with the
method that enqueues actions into the observation queue.
When the observation queue is nonempty, the next observation is dequeued
from it and conformance to the model program is validated by using the strategy.
If the observation queue is empty, a controllable (tester) action is selected using
the strategy. If no tester action is enabled in the current state of the strategy, the
conformance tester waits for an observable action to arrive within a time limit of
obsTimeout milliseconds.
Pages:
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353