如何输出日志放心,我想在我的报告中显示日志。不在控制台中 windows
How to output the log in restassured, I want to show the log in my report. not in console windows
given().
log().
ifValidationFails().
contentType(RestConfigKeys.KEY_REST_CONTENT_TYPE).
request().
body(jsonObject.toString()).
when().
post(resource).
then().
log().
ifValidationFails().
statusCode(201);
使用 restassured 验证 rest uri 和控制台中显示的日志 window 如下:
Request method: POST
Request URI: http://10.89.121.163/PSCLNP/rest/1/roles
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Multiparts: <none>
Headers: Accept=*/*
Content-Type=application/vnd.oracle.adf.resourceitem+json;
charset=ISO-8859-1
Cookies: <none>
Body:
{
"Role": "test001",
"Description": "test001",
"ValidFromDate": "2016-08-28",
"ValidToDate": "4712-12-31"
}
我想在我的报告中显示上面的日志,怎么办?
默认情况下 System.out
用作打印流。如果您希望在报告中显示您的日志,您需要向您的测试添加适当的日志记录或创建额外的 REST Assured 日志记录过滤器,它将日志发送到您的报告系统。
given().
log().
ifValidationFails().
contentType(RestConfigKeys.KEY_REST_CONTENT_TYPE).
request().
body(jsonObject.toString()).
when().
post(resource).
then().
log().
ifValidationFails().
statusCode(201);
使用 restassured 验证 rest uri 和控制台中显示的日志 window 如下:
Request method: POST
Request URI: http://10.89.121.163/PSCLNP/rest/1/roles
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Multiparts: <none>
Headers: Accept=*/*
Content-Type=application/vnd.oracle.adf.resourceitem+json;
charset=ISO-8859-1
Cookies: <none>
Body:
{
"Role": "test001",
"Description": "test001",
"ValidFromDate": "2016-08-28",
"ValidToDate": "4712-12-31"
}
我想在我的报告中显示上面的日志,怎么办?
默认情况下 System.out
用作打印流。如果您希望在报告中显示您的日志,您需要向您的测试添加适当的日志记录或创建额外的 REST Assured 日志记录过滤器,它将日志发送到您的报告系统。