【问题标题】:Extent Reports generating two HTML Reports范围报告生成两个 HTML 报告
【发布时间】:2020-05-05 06:30:29
【问题描述】:

所以我在过去的版本(自 2.0 及更高版本)中多次使用范围报告,并且在执行测试后我能够生成单个 html 报告,同样的情况发生在 3.0 版直到 4.0 版生成dashboard.html和 index.html。

从业务角度来看,拥有两个报告文件有点奇怪……我的代码是否遗漏了某些内容,或者这是新的报告标准?

ExtentReports 2.X 和 3.X 版本均生成单个报告文件 适用于 Java/C#

附上你可以看到我在 3.1 版上使用的实际代码来获取单个文件报告

            _extent = new ExtentReports();
            var dir = AppDomain.CurrentDomain.BaseDirectory.Replace("\\bin\\Debug", "");
            DirectoryInfo di = Directory.CreateDirectory(dir + "\\Test_Execution_Reports");
            var htmlReporter = new ExtentHtmlReporter(@"C:\testR\AutoReport.html");
            htmlReporter.LoadConfig("C:\\testR\\ReportConfig.xml");
            _extent.AddSystemInfo("Environment", "Test Report");
            _extent.AddSystemInfo("User Name", "Test User");
            _extent.AttachReporter(htmlReporter);

【问题讨论】:

    标签: c# extentreports


    【解决方案1】:

    以下解决了问题。

    我以前用过

    ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(reportPath);
    

    在 v4 中,我正在使用以下内容(基本上这会在 v4 上创建 v3 样式报告)

    ExtentV3HtmlReporter htmlReporter = new ExtentV3HtmlReporter(reportPath);
    

    所以请用 ExtentV3HtmlReporter 替换 ExtentHtmlReporter

    var htmlReporter = new ExtentV3HtmlReporter (@"C:\testR\AutoReport.html");
    

    【讨论】:

    • 谢谢@SuC。工作正常!很奇怪,为什么新版本会发生变化
    • 很高兴它帮助了你。
    • 这是否有助于为多个测试类别生成单一报告?
    猜你喜欢
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    相关资源
    最近更新 更多