Пример #1
0
        private void CreateHtmlReport()
        {
            HtmlReportGenerator gen = new HtmlReportGenerator();

            gen.GenerateStartTags();
            gen.GenerateLogHeader();
            gen.GenerateLogStatus(testData.Result.Outcome.Status.ToString(), testData.Result.Message, testData.Result.StackTrace, testData.ScreenshotPath, testData.VideoPath);
            foreach (var item in testData.actions.actions)
            {
                switch (item.type)
                {
                case ActionList.Action.ActionType.Link:
                    gen.GenerateLogLink(item.time.ToLongTimeString(), item.name);
                    break;

                case ActionList.Action.ActionType.Video:
                    gen.GenerateLogVideo(item.time.ToLongTimeString(), item.name);
                    break;

                case ActionList.Action.ActionType.Image:
                    gen.GenerateLogImage(item.time.ToLongTimeString(), item.name);
                    break;

                case ActionList.Action.ActionType.Error:
                    gen.GenerateLogError(item.time.ToLongTimeString(), item.name);
                    break;

                case ActionList.Action.ActionType.Warning:
                    gen.GenerateLogWarning(item.time.ToLongTimeString(), item.name);
                    break;

                case ActionList.Action.ActionType.Message:
                    gen.GenerateLogMessage(item.time.ToLongTimeString(), item.name);
                    break;

                default:
                    gen.GenerateLogRow(item.time.ToLongTimeString(), item.name);
                    break;
                }
            }
            gen.GenerateLogEnd();
            gen.GenerateEndTags();
            gen.WriteToFile();
        }
Пример #2
0
        private void CreateHtmlIndex()
        {
            HtmlReportGenerator gen = new HtmlReportGenerator();

            gen.GenerateStartTags();
            gen.GenerateIndexHead();
            gen.GenerateIndexSummary();
            var    results   = testDataCollection.OrderBy(x => x.Key).ToList();
            string classname = "";
            bool   first     = true;

            foreach (var item in results)
            {
                if (item.Value.ClassName != classname)
                {
                    if (first == true)
                    {
                        first = false;
                    }
                    else
                    {
                        gen.GenerateSuiteFooter();
                    }
                    gen.GenerateSuiteHeader(item.Value.ClassName);
                    classname = item.Value.ClassName;
                }

                if (item.Value.MethodName != null)
                {
                    gen.GenerateIndexRow(item.Key, item.Value.ReportPath, item.Value.Status, item.Value.ExceptionMessage);
                }
            }
            gen.GenerateLogEnd();
            gen.GenerateEndTags();
            gen.WriteToIndexFile();
        }