public void Process(Story story) { // use this report only for tic tac toe stories if (story.MetaData == null || !story.MetaData.Type.Name.Contains("TicTacToe")) return; var scenario = story.Scenarios.First(); var scenarioReport = new StringBuilder(); scenarioReport.AppendLine(string.Format(" SCENARIO: {0} ", scenario.Title)); if (scenario.Result != StepExecutionResult.Passed && scenario.Steps.Any(s => s.Exception != null)) { scenarioReport.Append(string.Format(" {0} : ", scenario.Result)); scenarioReport.AppendLine(scenario.Steps.First(s => s.Result == scenario.Result).Exception.Message); } scenarioReport.AppendLine(); foreach (var step in scenario.Steps) scenarioReport.AppendLine(string.Format(" [{1}] {0}", step.StepTitle, step.Result)); scenarioReport.AppendLine("--------------------------------------------------------------------------------"); scenarioReport.AppendLine(); File.AppendAllText(Path, scenarioReport.ToString()); }
public void Process(Story story) { foreach (var scenario in story.Scenarios) { Dispose(scenario); } }
public IEnumerable<IProcessor> GetProcessors(Story story) { var pipeline = from processor in _GetProcessors(story) orderby processor.ProcessType select processor; return pipeline.ToList(); }
private static void ReportStoryHeader(Story story) { if (story.MetaData == null || story.MetaData.Type == null) return; Console.WriteLine("Story: " + story.MetaData.Title); Console.WriteLine("\t" + story.MetaData.AsA); Console.WriteLine("\t" + story.MetaData.IWant); Console.WriteLine("\t" + story.MetaData.SoThat); }
public void Process(Story story) { foreach (var scenario in story.Scenarios) { foreach (var executionStep in scenario.Steps) { if (scenario.ExecuteStep(executionStep) == StepExecutionResult.Passed) continue; if(!executionStep.Asserts) break; } } }
public void Process(Story story) { var allSteps = story.Scenarios.SelectMany(s => s.Steps); if (!allSteps.Any()) return; var worseResult = story.Result; var stepWithWorseResult = allSteps.First(s => s.Result == worseResult); if (worseResult == StepExecutionResult.Failed || worseResult == StepExecutionResult.Inconclusive) { PreserveStackTrace(stepWithWorseResult.Exception); throw stepWithWorseResult.Exception; } if (worseResult == StepExecutionResult.NotImplemented) _assertInconclusive(); }
public void Process(Story story) { ReportStoryHeader(story); var allSteps = story.Scenarios.SelectMany(s => s.Steps).ToList(); if (allSteps.Any()) _longestStepSentence = allSteps.Max(s => PrefixWithSpaceIfRequired(s).Length); foreach (var scenario in story.Scenarios) { Report(scenario); if (scenario.Steps.Any()) { foreach (var step in scenario.Steps.Where(s => s.ShouldReport)) ReportOnStep(scenario, step); } } ReportExceptions(); }
IEnumerable<IProcessor> _GetProcessors(Story story) { var runner = TestRunner.ConstructFor(story); if (runner != null) yield return runner; var consoleReporter = ConsoleReport.ConstructFor(story); if (consoleReporter != null) yield return consoleReporter; yield return new ExceptionProcessor(); var storyCache = StoryCache.ConstructFor(story); if (storyCache != null) yield return storyCache; yield return new Disposer(); foreach (var addedProcessor in _addedProcessors) { yield return addedProcessor(); } }
public virtual bool RunsOn(Story story) { return true; }
private void AddStoryMetaDataAndNarrative(Story story) { using (OpenTag("<div class='storyMetaData'>", HtmlTag.div)) { if (story.MetaData == null) { var @namespace = story.Scenarios.First().TestObject.GetType().Namespace; AddLine(string.Format("<div class='namespaceName'>{0}</div>", @namespace)); } else { AddLine(string.Format("<div class='storyTitle'>{0}</div>", story.MetaData.Title)); } if (story.MetaData != null && !string.IsNullOrEmpty(story.MetaData.AsA)) { using (OpenTag("<ul class='storyNarrative'>", HtmlTag.ul)) { AddLine(string.Format("<li>{0}</li>", story.MetaData.AsA)); AddLine(string.Format("<li>{0}</li>", story.MetaData.IWant)); AddLine(string.Format("<li>{0}</li>", story.MetaData.SoThat)); } } } }
private void AddStory(Story story) { var scenariosInGroup = story.Scenarios; var storyResult = (StepExecutionResult)scenariosInGroup.Max(s => (int)s.Result); using (OpenTag(HtmlTag.li)) { using (OpenTag(string.Format("<div class='story {0}'>", storyResult), HtmlTag.div)) { AddStoryMetaDataAndNarrative(story); using (OpenTag("<div class='scenarios'>", HtmlTag.div)) { foreach (var scenario in scenariosInGroup) { AddScenario(scenario); } } } } }
public void Process(Story story) { Cache.Add(story); }