【问题标题】:What does the then() method do in REST-assured?then() 方法在 REST-assured 中做了什么?
【发布时间】:2018-05-21 19:30:03
【问题描述】:

我正在寻找 then() 方法在 REST-assured API 中的作用的正式定义,但在 javadocs 中找不到方法解释。它有什么作用?

参考: http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/RestAssured.html

【问题讨论】:

标签: java javadoc rest-assured


【解决方案1】:

Get 返回一个Response 对象:http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/response/Response.html

Response 继承了以下接口:ResponseBody、ResponseBodyData、ResponseBodyExtractionOptions、ResponseOptions、Validatable

then 是唯一的Validatable 方法:http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/response/Validatable.html

但是,这通过使用 ValidatableResponseOptions 来驱动大多数事件驱动的验证:http://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/response/ValidatableResponseOptions.html

在测试类中,这允许您编写专门用于验证其余端点的测试,而无需对 RestResponse 进行相对更混乱的拆包来评估响应的各个部分。

【讨论】:

    猜你喜欢
    • 2022-06-23
    • 2011-01-04
    • 2019-10-04
    • 2018-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多