我正在使用rest-assured库和扩展报告进行报告,
ValidatableResponse reponseManualLead = given().header("Accept", "application/json")
.contentType("application/json").header("Authorization", access_token)
.body(requestBody).log().body().when()
.put(losdevUrl + "/endUrl").then().log().all();log().all():在控制台日志中写入请求/响应日志,我需要将其记录在扩展报告中,我们可以做到这一点吗?
ExtentTestManager.getTest().log(LogStatus.INFO, "Response is:<br>" + "here");发布于 2019-02-02 03:57:01
包含JSON请求/响应的推荐用法是通过文档中的MarkupHelper实现的:http://extentreports.com/docs/versions/4/java/#markup-helpers-codeblock
Markup m = MarkupHelper.createCodeBlock(json, CodeLanguage.JSON);
test.pass(m);
// shorthand
test.pass(MarkupHelper.createCodeBlock(json, CodeLanguage.JSON));代码块将被美化并显示如下:

https://stackoverflow.com/questions/54328119
复制相似问题