【问题标题】:How to keep history of all execution in ExtentReports version 4?如何在 ExtentReports 版本 4 中保留所有执行的历史记录?
【发布时间】:2020-05-05 11:18:35
【问题描述】:

如何使用版本 4 在 ExtentReports Dashboard 中保留每个执行/运行的报告。它会覆盖以前的运行详细信息。

我目前正在使用:

Selenium WebDriver,
C#,
VS2019,
Specflow &
ExtentReports version4

不过,我可以使用 KLOV 和 MongoDB 完成此任务。我无法与其他利益相关者共享报告,因为他们没有必要的设置来访问报告。

在发布这个问题之前,显然我已经浏览了下面提到的这些链接,但找不到合适的解决方案

  1. Extent Reports V4 overwriting test results
  2. How can I append existing reports in ExtentReports 4

使用'ExtentV3HtmlReporter'但只得到一个新的报告ExtentReport.html,所以目前有3个不同的文件

  1. dashboard.html
  2. ExtentReport.html
  3. index.html

硒和 C#:

[BeforeTestRun]
    public static void InitialSetUp(IObjectContainer objectContainer)
    {
        //Initialize Extent report before test starts
        extent = new ExtentReports();
        var dir = AppDomain.CurrentDomain.BaseDirectory.Replace("\\bin\\Debug", "");
        DirectoryInfo diretcoryInfo = Directory.CreateDirectory(dir + "\\TestReports");
        var htmlReporter = new ExtentV3HtmlReporter(dir + "\\TestReports" + "\\ExtentReport" + ".html");
        htmlReporter.Config.Theme = AventStack.ExtentReports.Reporter.Configuration.Theme.Standard;
        extent.AddSystemInfo("Environment", "QA");
        extent.AddSystemInfo("Host Name", System.Net.Dns.GetHostName());
        extent.AddSystemInfo("OS Info", System.Environment.OSVersion.ToString());
        extent.AddSystemInfo("Browser", "Chrome");
        extent.AddSystemInfo("Username", System.Security.Principal.WindowsIdentity.GetCurrent().Name);

        //klov server set up
        //klovReporter = new ExtentKlovReporter();
        //klovReporter.InitMongoDbConnection("localhost", *****);
        //klovReporter.ProjectName = "*******";
        //klovReporter.ReportName = "UI Automation Report";
        //klovReporter.InitKlovServerConnection("http://localhost");

        //extent.AttachReporter(htmlReporter, klovReporter);
        extent.AttachReporter(htmlReporter);
    }

无法在 ExtentReports 版本 4 中获取历史报告。获取上次执行的测试/构建的报告。

【问题讨论】:

  • 每次运行套件时创建一个唯一的文件夹怎么样?

标签: c# selenium extentreports


【解决方案1】:

在 V4 范围报告中使用类 ExtentV3HtmlReporter htmlReport = new ExtentHtmlReporter(DirectoryPath)

【讨论】:

    猜你喜欢
    • 2011-09-08
    • 2011-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-18
    • 1970-01-01
    • 2011-10-18
    • 1970-01-01
    相关资源
    最近更新 更多