我是测试新手,需要使用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 :
创建 ExtentReports 的新实例。
ExtentReports extent = new ExtentReports(file-path, replaceExisting);
通过 startTest 方法命名并描述实例。请记住,您现在正在创建 ExtentTest 的新实例。
ExtentTest test = extent.startTest("Test Name", "Sample description");
根据 ExtentTest 实例记录结果。
test.log(LogStatus.PASS, "Step details");
结束测试。
extent.endTest(test);
最后将所有内容写入文档
extent.flush();
此外,这里是专门针对那些通过 Maven 实现的文档。
ExtentReports | Maven Documentation
...
关于java - 使用 Jersey 框架进行测试,并使用 Extentreports 进行报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35947898/