private static IHtmlNode GetFeatureSummary(IFeatureResult feature, int index) { var testExecutionTime = feature.Scenarios.GetTestExecutionTime(); var testAverageExecutionTime = feature.Scenarios.GetTestAverageExecutionTime(); return(Html.Tag(HtmlTextWriterTag.Tr).Content( Html.Tag(HtmlTextWriterTag.Td).Content( Html.Tag(HtmlTextWriterTag.A).Href("#feature" + index).Content(feature.Name), GetLabel(feature.Label)), Html.Tag(HtmlTextWriterTag.Td).Content(feature.Scenarios.Count().ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountScenariosWithStatus(ResultStatus.Passed).ToString()), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "bypassedAlert", feature.CountScenariosWithStatus(ResultStatus.Bypassed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "failedAlert", feature.CountScenariosWithStatus(ResultStatus.Failed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "ignoredAlert", feature.CountScenariosWithStatus(ResultStatus.Ignored)), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountSteps().ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountStepsWithStatus(ResultStatus.Passed).ToString()), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "bypassedAlert", feature.CountStepsWithStatus(ResultStatus.Bypassed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "failedAlert", feature.CountStepsWithStatus(ResultStatus.Failed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "ignoredAlert", feature.CountStepsWithStatus(ResultStatus.Ignored)), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountStepsWithStatus(ResultStatus.NotRun).ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(testExecutionTime.FormatPretty()), Html.Tag(HtmlTextWriterTag.Td).Class("hidden").Content(testExecutionTime.Ticks.ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(testAverageExecutionTime.FormatPretty()), Html.Tag(HtmlTextWriterTag.Td).Class("hidden").Content(testAverageExecutionTime.Ticks.ToString()) )); }
private static IHtmlNode GetFeatureSummary(IFeatureResult feature, int index) { var timeSummary = feature.GetScenarios().GetTestExecutionTimeSummary(); return(Html.Tag(Html5Tag.Tr).Content( Html.Tag(Html5Tag.Td).Content( Html.Tag(Html5Tag.A).Href("#feature" + index).Content(feature.Info.Name.Format(StepNameDecorator)), Html.Tag(Html5Tag.Span).Content(feature.Info.Labels.Select(GetLabel)).SkipEmpty()), Html.Tag(Html5Tag.Td).Content(feature.GetScenarios().Count().ToString()), Html.Tag(Html5Tag.Td).Content(feature.CountScenariosWithStatus(ExecutionStatus.Passed).ToString()), GetNumericTagWithOptionalClass(Html5Tag.Td, "bypassedAlert", feature.CountScenariosWithStatus(ExecutionStatus.Bypassed)), GetNumericTagWithOptionalClass(Html5Tag.Td, "failedAlert", feature.CountScenariosWithStatus(ExecutionStatus.Failed)), GetNumericTagWithOptionalClass(Html5Tag.Td, "ignoredAlert", feature.CountScenariosWithStatus(ExecutionStatus.Ignored)), Html.Tag(Html5Tag.Td).Content(feature.CountSteps().ToString()), Html.Tag(Html5Tag.Td).Content(feature.CountStepsWithStatus(ExecutionStatus.Passed).ToString()), GetNumericTagWithOptionalClass(Html5Tag.Td, "bypassedAlert", feature.CountStepsWithStatus(ExecutionStatus.Bypassed)), GetNumericTagWithOptionalClass(Html5Tag.Td, "failedAlert", feature.CountStepsWithStatus(ExecutionStatus.Failed)), GetNumericTagWithOptionalClass(Html5Tag.Td, "ignoredAlert", feature.CountStepsWithStatus(ExecutionStatus.Ignored)), Html.Tag(Html5Tag.Td).Content(feature.CountStepsWithStatus(ExecutionStatus.NotRun).ToString()), Html.Tag(Html5Tag.Td).Content(timeSummary.Duration.FormatPretty()), Html.Tag(Html5Tag.Td).Class("hidden").Content(timeSummary.Duration.Ticks.ToString()), Html.Tag(Html5Tag.Td).Content(timeSummary.Aggregated.FormatPretty()), Html.Tag(Html5Tag.Td).Class("hidden").Content(timeSummary.Aggregated.Ticks.ToString()), Html.Tag(Html5Tag.Td).Content(timeSummary.Average.FormatPretty()), Html.Tag(Html5Tag.Td).Class("hidden").Content(timeSummary.Average.Ticks.ToString()) )); }
private static XElement ToSummaryXElement(IFeatureResult[] features) { var objects = new List<object> { new XAttribute("TestExecutionStart", features.GetTestExecutionStartTime()), new XAttribute("TestExecutionTime", features.GetTestExecutionTime()), new XElement("Features", new object[] {new XAttribute("Count", features.Length)}), new XElement("Scenarios", new XAttribute("Count", features.CountScenarios()), new XAttribute("Passed", features.CountScenariosWithStatus(ResultStatus.Passed)), new XAttribute("Bypassed", features.CountScenariosWithStatus(ResultStatus.Bypassed)), new XAttribute("Failed", features.CountScenariosWithStatus(ResultStatus.Failed)), new XAttribute("Ignored", features.CountScenariosWithStatus(ResultStatus.Ignored))), new XElement("Steps", new XAttribute("Count", features.CountSteps()), new XAttribute("Passed", features.CountStepsWithStatus(ResultStatus.Passed)), new XAttribute("Bypassed", features.CountStepsWithStatus(ResultStatus.Bypassed)), new XAttribute("Failed", features.CountStepsWithStatus(ResultStatus.Failed)), new XAttribute("Ignored", features.CountStepsWithStatus(ResultStatus.Ignored)), new XAttribute("NotRun", features.CountStepsWithStatus(ResultStatus.NotRun))) }; return new XElement("Summary", objects); }
private static void FormatSummary(StringBuilder builder, IFeatureResult[] features) { builder.AppendLine("Summary:"); var summary = new Dictionary<string, object> { {"Test execution start time", features.GetTestExecutionStartTime().ToString("yyyy-MM-dd HH:mm:ss UTC")}, {"Test execution time", features.GetTestExecutionTime().FormatPretty()}, {"Number of features", features.Length}, {"Number of scenarios", features.CountScenarios()}, {"Passed scenarios", features.CountScenariosWithStatus(ResultStatus.Passed)}, {"Bypassed scenarios", features.CountScenariosWithStatus(ResultStatus.Bypassed)}, {"Failed scenarios", features.CountScenariosWithStatus(ResultStatus.Failed)}, {"Ignored scenarios", features.CountScenariosWithStatus(ResultStatus.Ignored)}, {"Number of steps", features.CountSteps()}, {"Passed steps", features.CountStepsWithStatus(ResultStatus.Passed)}, {"Bypassed steps", features.CountStepsWithStatus(ResultStatus.Bypassed)}, {"Failed steps", features.CountStepsWithStatus(ResultStatus.Failed)}, {"Ignored steps", features.CountStepsWithStatus(ResultStatus.Ignored)}, {"Not Run steps", features.CountStepsWithStatus(ResultStatus.NotRun)} }; var maxLength = summary.Keys.Max(k => k.Length); var format = string.Format("\t{{0,-{0}}}: {{1}}", maxLength); foreach (var row in summary) builder.AppendFormat(format, row.Key, row.Value).AppendLine(); }
private static IHtmlNode GetFeatureSummary(IFeatureResult feature, int index) { var testExecutionTime = feature.Scenarios.GetTestExecutionTime(); var testAverageExecutionTime = feature.Scenarios.GetTestAverageExecutionTime(); return Html.Tag(HtmlTextWriterTag.Tr).Content( Html.Tag(HtmlTextWriterTag.Td).Content( Html.Tag(HtmlTextWriterTag.A).Href("#feature" + index).Content(feature.Name), GetLabel(feature.Label)), Html.Tag(HtmlTextWriterTag.Td).Content(feature.Scenarios.Count().ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountScenariosWithStatus(ResultStatus.Passed).ToString()), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "bypassedAlert", feature.CountScenariosWithStatus(ResultStatus.Bypassed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "failedAlert", feature.CountScenariosWithStatus(ResultStatus.Failed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "ignoredAlert", feature.CountScenariosWithStatus(ResultStatus.Ignored)), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountSteps().ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountStepsWithStatus(ResultStatus.Passed).ToString()), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "bypassedAlert", feature.CountStepsWithStatus(ResultStatus.Bypassed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "failedAlert", feature.CountStepsWithStatus(ResultStatus.Failed)), GetNumericTagWithOptionalClass(HtmlTextWriterTag.Td, "ignoredAlert", feature.CountStepsWithStatus(ResultStatus.Ignored)), Html.Tag(HtmlTextWriterTag.Td).Content(feature.CountStepsWithStatus(ResultStatus.NotRun).ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(testExecutionTime.FormatPretty()), Html.Tag(HtmlTextWriterTag.Td).Class("hidden").Content(testExecutionTime.Ticks.ToString()), Html.Tag(HtmlTextWriterTag.Td).Content(testAverageExecutionTime.FormatPretty()), Html.Tag(HtmlTextWriterTag.Td).Class("hidden").Content(testAverageExecutionTime.Ticks.ToString()) ); }