3(b).
264 Reactive Systems
16.3 Asynchronous stepping
Recall that testing requires a test harness called a stepper (Sections 8.3 and 12.2.3).
In order to test a reactive IUT, the IUT has to support the asynchronous stepper
interface IAsyncStepper that is declared in the NModel.Conformance namespace.
The interface derives from the IStepper interface (see Section 12.2.3) and has
one additional method called SetObserver. The SetObserver method is invoked
initially by the conformance tester to set a callback function that enters observable
actions into an observation queue. The observation queue is monitored by the conformance
tester during test execution, as explained in Section 16.5.
namespace NModel.Conformance
{
public delegate void ObserverDelegate(Action action);
public interface IAsyncStepper : IStepper
{
void SetObserver(ObserverDelegate observer);
}
}
When implementing an (asynchronous) stepper, the basic stepping functionality
has not changed. The difference is that the stepper can now, in addition, implement a
mechanism that directs asynchronous or spontaneous events produced by the IUT to
the conformance tester. In other words, the job of the stepper is to map those events
to observable actions that the model program understands and invoke the observer.
By invoking the observer, the observable actions are entered into the observation
queue to be processed by the conformance tester.
Pages:
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348