Count < steps ||
(!strategy.IsInAcceptingState && trace.Count < maxSteps))
{
if (o != null)
{
trace = trace.AddLast(o);
string reason = "";
if (strategy.IsActionEnabled(o, out reason)) //check conformance
{ strategy.DoAction(o); o = null; }
else
return new TestResult(k, Verdict.Failure, reason, trace);
}
else
{
Action a = strategy.SelectAction(testerActionSymbols);
if (a == null)
if (strategy.IsInAcceptingState)
return new TestResult(k, Verdict.Success, "", trace);
else
return new TestResult(k, Verdict.Failure,
"Did not finish in accepting state", trace);
else
{
strategy.DoAction(a);
trace = trace.AddLast(a);
if (!internalActionSymbols.Contains(a.FunctionSymbol))
{
try
o = InvokeStepper(a);
catch (Exception e)
return new TestResult(k, Verdict.Failure, e.Message, trace);
}
}
}
}
}
Figure 12.7. Outline of the algorithm executing a single test run.
216 Testing Systems with Complex State
steps. When that lower limit is reached, the algorithm tries to reach an accepting
state without exceeding an upper limit maxSteps on the number of actions. The
InvokeStepper method uses a worker thread to invoke the stepper to do the given
action in the implementation. This thread calls the DoAction method in the stepper
(see Figure 12.4, for example). If the invocation does not return within a time limit
given by the timeout option of ct, then the test run fails.
Pages:
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289