gpt4 book ai didi

java - 使用 Jersey 框架进行测试,并使用 Extentreports 进行报告

转载 作者:行者123 更新时间:2023-11-30 07:32:11 24 4
gpt4 key购买 nike

我是测试新手,需要使用extentreports报告测试结果,

下面是测试代码:

public ExtentReports reports;
public ExtentTest logger;

public ModelTests() {
reports = new ExtentReports("acceptanceTest\\reports\\Report.html");
}

@Test
public void searchModelTest() throws JSONException, URISyntaxException {
JSONObject jsonResponse = searchModel();
logger = reports.startTest("Test");
logger.log(LogStatus.PASS, "Success");
assertEquals("SOLAR SLEEVE 2014", jsonResponse.getString("modelName"));
logger.log(LogStatus.FAIL, "Failure");
reports.endTest(logger);
}

我没有看到生成任何报告。

extentreport 可以与 jersey 框架一起使用吗?我看过 selenium 示例。

帮助将不胜感激。

最佳答案

这是您应该遵循的 list :

  1. 创建 ExtentReports 的新实例。

    ExtentReports extent = new ExtentReports(file-path, replaceExisting);

  2. 通过 startTest 方法命名并描述实例。请记住,您现在正在创建 ExtentTest 的新实例。

    ExtentTest test = extent.startTest("Test Name", "Sample description");

  3. 根据 ExtentTest 实例记录结果。

    test.log(LogStatus.PASS, "Step details");

  4. 结束测试。

    extent.endTest(test);

  5. 最后将所有内容写入文档

    extent.flush();

此外,这里是专门针对那些通过 Maven 实现的文档。

ExtentReports | Maven Documentation

...

关于java - 使用 Jersey 框架进行测试,并使用 Extentreports 进行报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35947898/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com