protected override Task executeSteps(SpecContext context, IList <ILineExecution> lines, CancellationToken token) { _steps = lines; Context = context; _observer.SendProgress(new SpecProgress(Context.Specification.id, Context.Counts, 0, _steps.Count)); _executionObserver.SpecStarted(Request); if (Request.Mode == ExecutionMode.stepthrough) { sendNextStepMessage(); } else if (Request.Mode == ExecutionMode.breakpoint) { RunToBreakpoint(); } else { return(base.executeSteps(context, lines, token)); } _hasStarted.SetResult(true); return(_completion.Task); }
public SpecificationEngine(ISystem system, ISpecRunner runner, IExecutionObserver observer) { _system = system; _runner = runner; _executionQueue = new ConsumingQueue(request => { if (request.IsCancelled) { return; } _warmup.Wait(30.Seconds()); observer.SpecStarted(request); var results = _runner.Execute(request, _executionQueue ); if (!request.IsCancelled && results != null) { // TODO -- combine the two things here? request.SpecExecutionFinished(results); observer.SpecFinished(request); } }); _warmup = _system.Warmup().ContinueWith(t => { if (t.IsFaulted) { _runner.MarkAsInvalid(t.Exception); } }); }
public SpecificationEngine(ISystem system, ISpecRunner runner, IExecutionObserver observer) { _system = system; _runner = runner; _executionQueue = new ConsumingQueue(request => { if (request.IsCancelled) { return; } _warmup.Wait(30.Seconds()); observer.SpecStarted(request); var results = _runner.Execute(request, _executionQueue); if (!request.IsCancelled && results != null) { // TODO -- combine the two things here? request.SpecExecutionFinished(results); observer.SpecFinished(request); } }); _warmup = _system.Warmup().ContinueWith(t => { if (t.IsFaulted) { _runner.MarkAsInvalid(t.Exception); } }); }
public SpecResults Execute(SpecExecutionRequest request, IConsumingQueue queue) { _mode.BeforeRunning(request); if (Status == SpecRunnerStatus.Invalid) { var abortedResults = SpecResults.ForAbortedRun(request.Id); _mode.AfterRunning(request, abortedResults, queue, Status); return(abortedResults); } request.Plan.Attempts++; var timings = request.StartNewTimings(); SpecResults results = null; try { Current = request.Mode == ExecutionMode.normal ? new SpecExecution(request, _stopConditions, _mode.BuildLogger()) : new StepthroughExecution(request, _stopConditions, _mode.Observer(), _observer); _observer.SpecStarted(request); results = Current.Execute(_system, timings); } catch (Exception ex) // Any exception that bubbles up is telling us that the runner is invalid { MarkAsInvalid(ex); results = buildResultsForContextCreationFailure(request, ex, timings); } finally { _mode.AfterRunning(request, results, queue, Status); timings.Dispose(); } return(results); }