Beispiel #1
0
        private static XElement ToXElement(IScenarioResult scenario)
        {
            var objects = new List <object>
            {
                new XAttribute("Status", scenario.Status.ToString()),
                new XAttribute("Name", scenario.Info.Name),
                ToXElement(scenario.Info.Name)
            };

            objects.AddRange(scenario.Info.Labels.Select(label => new XElement("Label", new XAttribute("Name", label))));

            if (scenario.ExecutionTime != null)
            {
                objects.Add(new XAttribute("ExecutionStart", scenario.ExecutionTime.Start));
                objects.Add(new XAttribute("ExecutionTime", scenario.ExecutionTime.Duration));
            }
            if (scenario.Info.Categories.Any())
            {
                objects.AddRange(scenario.Info.Categories.Select(c => new XElement("Category", new XAttribute("Name", c))));
            }
            objects.AddRange(scenario.GetSteps().Select(s => ToXElement(s, "Step")));

            if (!string.IsNullOrWhiteSpace(scenario.StatusDetails))
            {
                objects.Add(new XElement("StatusDetails", scenario.StatusDetails));
            }

            return(new XElement("Scenario", objects));
        }
Beispiel #2
0
        private static void FormatScenario(TextWriter writer, IScenarioResult scenario)
        {
            writer.WriteLine();
            writer.Write("\tScenario: ");
            writer.Write(scenario.Info.Name);
            FormatLabels(writer, scenario.Info.Labels);
            writer.Write(" - ");
            writer.Write(scenario.Status);

            if (scenario.ExecutionTime != null)
            {
                writer.Write(" (");
                writer.Write(scenario.ExecutionTime.Duration.FormatPretty());
                writer.Write(")");
            }
            writer.WriteLine();

            if (scenario.Info.Categories.Any())
            {
                writer.Write("\t\tCategories: ");
                writer.WriteLine(string.Join(", ", scenario.Info.Categories));
            }

            var commentBuilder = new StringBuilder();

            foreach (var step in scenario.GetSteps())
            {
                FormatStep(writer, step, commentBuilder);
            }
            FormatDetails(writer, scenario);
            FormatComments(writer, commentBuilder);
        }
Beispiel #3
0
        private IHtmlNode GetScenario(IScenarioResult scenario, int featureIndex, int scenarioIndex)
        {
            var toggleId   = string.Format("toggle{0}_{1}", featureIndex, scenarioIndex);
            var scenarioId = string.Format("scenario{0}_{1}", featureIndex, scenarioIndex + 1);

            return(Html.Tag(Html5Tag.Div).Class("scenario " + GetStatusClass(scenario.Status)).Attribute("data-categories", GetScenarioCategories(scenario)).Content(
                       Html.Checkbox().Id(toggleId).Class("toggle toggleS").Checked(),
                       Html.Tag(Html5Tag.H3).Id(scenarioId).Class("title").Content(
                           Html.Tag(Html5Tag.Label).For(toggleId).Content(
                               GetCheckBoxTag(),
                               GetStatus(scenario.Status),
                               Html.Text(scenario.Info.Name.Format(StepNameDecorator))),
                           Html.Tag(Html5Tag.Span).Content(scenario.Info.Labels.Select(GetLabel)).SkipEmpty(),
                           GetDuration(scenario.ExecutionTime),
                           GetSmallLink(scenarioId)),
                       Html.Tag(Html5Tag.Div).Class("categories").Content(string.Join(", ", scenario.Info.Categories)).SkipEmpty(),
                       Html.Tag(Html5Tag.Div).Content(scenario.GetSteps().Select(GetStep)),
                       GetStatusDetails(scenario.StatusDetails),
                       GetComments(scenario.GetSteps()),
                       Html.Br()));
        }
 public void NotifyScenarioFinished(IScenarioResult scenario)
 {
     _notifications.Add($"Scenario Finish: {FormatScenario(scenario.Info)} | Status:{scenario.Status} | ExecutionTimePresent:{scenario.ExecutionTime != null} | Steps:{scenario.GetSteps().Count()} | Details:{scenario.StatusDetails}");
 }
Beispiel #5
0
 /// <summary>
 /// Returns all the steps with their sub steps, belonging to scenario.
 /// </summary>
 public static IEnumerable <IStepResult> GetAllSteps(this IScenarioResult scenario)
 {
     return(scenario.GetSteps().SelectMany(x => x.GetAllSteps()));
 }
 /// <summary>
 /// Counts all steps with given status.
 /// </summary>
 public static int CountStepsWithStatus(this IScenarioResult result, ExecutionStatus status)
 {
     return(result.GetSteps().Count(s => s.Status == status));
 }