5.2 Test execution and termination
The two primary options of ct that directly control the size of a generated test suite
are runs and steps. The value of runs is the desired number of test runs. Each test
run starts from the initial state of the model program. Both the IUT and the strategy
are reset between test runs. Recall that resetting the strategy resets the underlying
model program. This is an outline of the top-level loop:
int k = 0;
while (k < runs)
{
if (!TestResultNotifier(RunTest(k))) return;
strategy.Reset();
stepper.Reset();
k += 1;
}
The test result notifier is a delegate that can be set in the conformance tester. This
delegate controls when the conformance tester should terminate. In ct this delegate
is set to a function that outputs the test result and returns false, if the test run failed
and the continueOnFailure option of ct is turned off, and returns true otherwise.
Each test result is written either to the console or to a log file if one is provided by
the logfile option of ct.
Test execution algorithm. An outline of the algorithm that executes a single
test run is shown in Figure 12.7. Each individual test run starts from the initial
state and attempts to produce a run of at least as many actions as specified by
Systems with Complex State 215
TestResult RunTest(int k)
{
Sequence
trace = Sequence.EmptySequence;
Action o = null; // optional output from the stepper
while (trace.
Pages:
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288