范围报告V4覆盖测试结果

范围报告V4覆盖测试结果

本文介绍了范围报告V4覆盖测试结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Extent Reports V3与硒/C#一起使用,而我刚刚升级到V4.以前,每次运行都会根据日期戳/类名称/时间戳给我一个独特的报告.但是,移至V4后,它始终将所有内容放在同一个名为索引"的文件和一个单独的名为仪表板"的文件下,该文件位于另一个文件的上方以进行导航.

I was using Extent Reports V3 with selenium / C# and I just upgraded to V4. Previously each run would give me a unique report based on the Date stamp / Class Name / Time stamp. However, after moving to V4, it always puts everything under the same file named "index" and a separate file named "dashboard" which is a file to sit above the other for navigation purposes.

这是我启动报告的代码:

Here is my code for starting the report:

    htmlReporter = new ExtentHtmlReporter($"C:\\Test-Results\\" + dateStamp + "\\" + TestClassName + " " + timeStamp + ".html");
    extent = new ExtentReports();
    extent.AttachReporter(htmlReporter);
    extent.AddSystemInfo("Host Name", "Extent Framework");
    extent.AddSystemInfo("Environment", "Local Machine");
    extent.AddSystemInfo("User Name", "MyName");
    htmlReporter.LoadConfig(CurrentDirectory + "\\extent-config.xml");

现在,每次运行测试时,它都会用新的测试结果覆盖现有的索引文件,而不是附加当前的结果或为我提供唯一的索引文件.我可以提供有关如何启动报告/如何创建测试(如果需要)的任何其他信息,但现在这是我的测试文件中包含的内容:

Now, each time I run a test, it overwrites the existing Index file with the new test results rather than appending my current results OR giving me a unique index file. I can provide any additional information needed about how i'm starting the reports / creating the tests if needed but for now here is what lives in my test file:

    [ClassInitialize()]
    public static void MyClassInitialize(TestContext testContext)
    {
        report.startReport("Report Name");
    }

    [ClassCleanup()]
    public static void MyClassCleanup()
    {
        report.Flush();
    }

    [TestInitialize()]
    public void MyTestInitialize()
    {
        string name = TestContext.TestName;
        report.CreateTest(name);

    }

推荐答案

它是v4的增强功能.为了克服它,我们必须在版本4中使用ExtentV3HtmlReporter类.通过使用此类,我们将像以前一样拥有Reports.它不会被索引文件覆盖.另外,V4中解决了许多错误.因此,使用的内容与版本4报告相同.您可以将两个报告进行比较,然后您将获得解决方案.

It is enhanced feature of v4. To overcome it, We have to use ExtentV3HtmlReporter class in version 4. By using this class, We will be have Reports as we had. It will not override with index file. Also, There are many bugs get solved in V4. So things used same as version 4 report. You can compare both reports and you will be have your solution.

这篇关于范围报告V4覆盖测试结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 13:11