如何输出日志安装,我想在我的报告中显示日志。不在控制台窗口

时间:2017-05-11 04:56:12

标签: logging rest-assured

  given().
            log().
            ifValidationFails().
            contentType(RestConfigKeys.KEY_REST_CONTENT_TYPE).
            request().
            body(jsonObject.toString()).
            when().
            post(resource).
            then().
            log().
            ifValidationFails().
            statusCode(201);

使用restassured验证休息uri并在控制台窗口中显示如下日志:

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"
}

我想在上面显示登录我的报告,怎么做?

1 个答案:

答案 0 :(得分:0)

默认情况下,System.out用作打印流。如果您希望在报告中显示日志,则需要在测试中添加正确的日志记录,或者创建其他REST Assured日志过滤器,以便将日志发送到报告系统。