Exemplo n.º 1
0
        private HtmlTag BuildScenario(Scenario scenario)
        {
            var scenarioText = scenario.GetScenarioText();

            Console.WriteLine($"Scenario text output is: {scenarioText}");

            return(new HtmlTag("tr").AddClass(HtmlReportPrebuilt.GetStatus(scenario) + _storiesBuiltCounter).AddClass(HtmlReportPrebuilt.GetStatus(scenario)).Append(
                       new HtmlTag("td").Append(
                           new HtmlTag("details").Append(
                               new HtmlTag("summary").Append(
                                   new HtmlTag("span").AddClass("ScenarioText").AppendText(
                                       scenarioText
                                       )
                                   ),
                               new HtmlTag("p").Append(
                                   BuildSteps(scenario.Steps)
                                   )
                               )
                           ),
                       new HtmlTag("td").Append(
                           HtmlReportPrebuilt.GetStatusIcon(scenario)
                           ),
                       new HtmlTag("td").AppendText(
                           scenario.TimeTaken.ToPrettyFormat()
                           ),
                       new HtmlTag("td").AppendText(
                           scenario.StartTime.ToStringForReport()
                           ),
                       new HtmlTag("td").AppendText(
                           scenario.EndTime.ToStringForReport()
                           )
                       ));
        }
Exemplo n.º 2
0
        private HtmlTag BuildScenario(Scenario scenario)
        {
            var scenarioText = scenario.GetScenarioText();

            return(new HtmlTag("tr").AddClass(HtmlReportPrebuilt.GetStatus(scenario) + _storiesBuiltCounter).AddClass(HtmlReportPrebuilt.GetStatus(scenario)).Append(
                       new HtmlTag("td").Append(
                           new HtmlTag("details").Append(
                               new HtmlTag("summary").Append(
                                   new HtmlTag("span").AddClass("ScenarioText").AppendText(
                                       scenarioText
                                       )
                                   ),
                               new HtmlTag("p").Style("margin-left", "25px").Append(
                                   BuildSteps(scenario.Steps),
                                   BuildScenarioTeardownOutput(scenario)
                                   )
                               )
                           ),
                       new HtmlTag("td").Append(
                           HtmlReportPrebuilt.GetStatusIcon(scenario)
                           ),
                       new HtmlTag("td").AppendText(
                           scenario.TimeTaken.ToPrettyFormat()
                           ),
                       new HtmlTag("td").AppendText(
                           scenario.StartTime.ToStringForReport()
                           ),
                       new HtmlTag("td").AppendText(
                           scenario.EndTime.ToStringForReport()
                           )
                       ));
        }
Exemplo n.º 3
0
        private HtmlTag BuildStep(Step step)
        {
            var     expandedStepInfo = BuildStepExpandedInfo(step);
            HtmlTag stepEntry;

            if (expandedStepInfo == null)
            {
                stepEntry = new HtmlTag("span").AppendText(step.StepText);
            }
            else
            {
                stepEntry = new HtmlTag("details").Append(
                    new HtmlTag("summary").AppendText(
                        step.StepText
                        ),
                    expandedStepInfo
                    );
            }

            return(new HtmlTag("tr").Append(
                       new HtmlTag("td").Append(
                           stepEntry
                           ),
                       new HtmlTag("td").Append(
                           HtmlReportPrebuilt.GetStatusIcon(step)
                           ),
                       new HtmlTag("td").AppendText(
                           step.TimeTaken.ToPrettyFormat()
                           ),
                       new HtmlTag("td").AppendText(
                           step.StartTime.ToStringForReport()
                           ),
                       new HtmlTag("td").AppendText(
                           step.EndTime.ToStringForReport()
                           )
                       ).Style("margin-left", "25px"));
        }
Exemplo n.º 4
0
        private HtmlTag BuildStory(IEnumerable <Scenario> enumerableScenarios)
        {
            _storiesBuiltCounter++;
            var scenarios = enumerableScenarios.ToList();
            var storyText = scenarios.FirstOrDefault()?.GetStoryText();

            Console.WriteLine($"Scenario text output is: {storyText}");

            return
                (new HtmlTag("div").Append(
                     new HtmlTag("div").AddClass("Story").AddClass(HtmlReportPrebuilt.GetStatus(scenarios)).Append(
                         new HtmlTag("h4").AddClass("StoryText").AppendText(
                             $"Story: {storyText}"
                             ),
                         new HtmlTag("table").Append(
                             new HtmlTag("thead").Append(
                                 new HtmlTag("tr").Append(
                                     new HtmlTag("th").AppendText("Status"),
                                     new HtmlTag("th").AppendText("Scenarios"),
                                     new HtmlTag("th").Append(
                                         new HtmlTag("div").Append(
                                             HtmlReportPrebuilt.PassedIcon
                                             ),

                                         new HtmlTag("input").Attr("type", "checkbox").Attr("checked", "checked").Id($"Passed{_storiesBuiltCounter}")
                                         ),
                                     new HtmlTag("th").Append(
                                         new HtmlTag("div").Append(
                                             HtmlReportPrebuilt.FailedIcon
                                             ),
                                         new HtmlTag("input").Attr("type", "checkbox").Attr("checked", "checked").Id($"Failed{_storiesBuiltCounter}")
                                         ),
                                     new HtmlTag("th").Append(
                                         new HtmlTag("div").Append(
                                             HtmlReportPrebuilt.InconclusiveIcon
                                             ),
                                         new HtmlTag("input").Attr("type", "checkbox").Attr("checked", "checked").Id($"Inconclusive{_storiesBuiltCounter}")
                                         ),
                                     new HtmlTag("th").Append(
                                         new HtmlTag("div").Append(
                                             HtmlReportPrebuilt.NotImplementedIcon
                                             ),
                                         new HtmlTag("input").Attr("type", "checkbox").Attr("checked", "checked").Id($"NotImplemented{_storiesBuiltCounter}")
                                         ),
                                     new HtmlTag("th").AppendText("Duration"),
                                     new HtmlTag("th").AppendText("Start"),
                                     new HtmlTag("th").AppendText("End")
                                     )
                                 ),
                             new HtmlTag("tbody").Append(
                                 new HtmlTag("tr").Append(
                                     new HtmlTag("td").Append(
                                         HtmlReportPrebuilt.GetStatusIcon(scenarios)
                                         ),
                                     new HtmlTag("td").AppendText(
                                         scenarios.Count().ToString()
                                         ),
                                     new HtmlTag("td").AppendText(
                                         scenarios.Count(scenario => scenario.Status == Status.Passed).ToString()
                                         ),
                                     new HtmlTag("td").AppendText(
                                         scenarios.Count(scenario => scenario.Status == Status.Failed).ToString()
                                         ),
                                     new HtmlTag("td").AppendText(
                                         scenarios.Count(scenario => scenario.Status == Status.Inconclusive).ToString()
                                         ),
                                     new HtmlTag("td").AppendText(
                                         scenarios.Count(scenario => scenario.Status == Status.NotImplemented).ToString()
                                         ),
                                     new HtmlTag("td").AppendText(
                                         (scenarios.GetEndDateTime() - scenarios.GetStartDateTime())
                                         .ToPrettyFormat()
                                         ),
                                     new HtmlTag("td").AppendText(
                                         scenarios.OrderBy(scenario => scenario.StartTime).First().StartTime
                                         .ToStringForReport()
                                         ),
                                     new HtmlTag("td").AppendText(
                                         scenarios.OrderByDescending(scenario => scenario.EndTime).First().EndTime
                                         .ToStringForReport()
                                         )
                                     )
                                 )
                             ),
                         new HtmlTag("details").Append(
                             new HtmlTag("summary").AddClass("canToggle").AppendText("Scenarios"),
                             new HtmlTag("p").Append(
                                 new HtmlTag("h4").Append(
                                     BuildScenariosSection(scenarios)
                                     )
                                 )
                             ),
                         BuildChart()
                         )
                     ));
        }