public bool ShouldRetry(SpecResults results, Specification specification, SpecRunnerStatus status) { if (results.Counts.WasSuccessful()) { return(false); } if (status == SpecRunnerStatus.Invalid) { return(false); } if (results.HadCriticalException) { return(false); } if (specification.Lifecycle == Lifecycle.Acceptance) { return(false); } return(specification.MaxRetries > (results.Attempts - 1) || Project.CurrentMaxRetries > (results.Attempts)); }
public void MarkAsInvalid(Exception ex) { Status = SpecRunnerStatus.Invalid; ConsoleWriter.Write(ConsoleColor.Yellow, "Failed to create an execution context. No specifications can be processed until this is addressed"); ConsoleWriter.Write(ConsoleColor.Red, ex.ToString()); EventAggregator.SendMessage(new PassthroughMessage(new RuntimeError(ex))); }
public void AfterRunning(SpecExecutionRequest request, SpecResults results, IConsumingQueue queue, SpecRunnerStatus status) { if (ShouldRetry(results, request.Specification, status)) { _resultObserver.SpecRequeued(request); queue.Enqueue(request); } else { _resultObserver.SpecHandled(request, results); } }
public bool ShouldRetry(SpecResults results, Specification specification, SpecRunnerStatus status) { if (results.Counts.WasSuccessful()) return false; if (status == SpecRunnerStatus.Invalid) return false; if (results.HadCriticalException) return false; if (specification.Lifecycle == Lifecycle.Acceptance) return false; return specification.MaxRetries > (results.Attempts - 1) || Project.CurrentMaxRetries > (results.Attempts); }
public BatchExecutionModeTester() { Project.CurrentProject = new Project { MaxRetries = 0 }; theSpecification = new Specification(); theResults = new SpecResults { HadCriticalException = false, Counts = new Counts(0, 1, 0, 0) }; theStatus = SpecRunnerStatus.Valid; }
protected override void beforeEach() { Project.CurrentProject = new Project { MaxRetries = 0 }; theSpecification = new Specification(); theResults = new SpecResults { HadCriticalException = false, Counts = new Counts(0, 1, 0, 0) }; theStatus = SpecRunnerStatus.Valid; }
public void AfterRunning(SpecExecutionRequest request, SpecResults results, IConsumingQueue queue, SpecRunnerStatus status) { }
public void never_retry_when_the_spec_runner_is_in_an_invalid_state() { theSpecification.Lifecycle = Lifecycle.Regression; theStatus = SpecRunnerStatus.Invalid; ClassUnderTest.ShouldRetry(theResults, theSpecification, theStatus).ShouldBe(false); }