【问题标题】:How to generate test report using selenium web driver如何使用 selenium web 驱动程序生成测试报告
【发布时间】:2014-09-16 06:46:07
【问题描述】:

我想知道除了 selenium webdriver 中的 TestNG 框架之外,是否还有其他选项可用于生成测试报告

【问题讨论】:

标签: selenium


【解决方案1】:

您可以尝试 ExtentReports:http://extentreports.com。一个例子:

public class Main {
public static void main(String[] args) {
    // start reporters
    ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent.html");

    // create ExtentReports and attach reporter(s)
    ExtentReports extent = new ExtentReports();
    extent.attachReporter(htmlReporter);

    // creates a toggle for the given test, adds all log events under it    
    ExtentTest test = extent.createTest("MyFirstTest", "Sample description");

    // log(Status, details)
    test.log(Status.INFO, "This step shows usage of log(status, details)");

    // info(details)
    test.info("This step shows usage of info(details)");

    // log with snapshot
    test.fail("details", MediaEntityBuilder.createScreenCaptureFromPath("screenshot.png").build());

    // test with snapshot
    test.addScreenCaptureFromPath("screenshot.png");

    // calling flush writes everything to the log file
    extent.flush();
}
}

【讨论】:

  • 谢谢。更新了最新版本 3 的链接和用法。
【解决方案2】:

尝试 Allure 报告框架

https://github.com/allure-framework

希望对你有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多