繁体   English   中英

Rest Assured 中的 given() 和 with() 有什么区别?

[英]What is the difference between given() and with() in Rest Assured?

 RequestSpecification request1 = RestAssured.given();
        // Setting Base URI
        request1.baseUri("https://restful-booker.herokuapp.com");
        // Setting Base Path
        request1.basePath("/booking");

        // Creating request specification using with()
        RequestSpecification request2 = RestAssured.with();
        // Setting Base URI
        request2.baseUri("https://restful-booker.herokuapp.com");
        // Setting Base Path
        request2.basePath("/ping");

在这里我们同时使用两者有什么区别?

方法:“and”、“with”、“when”、“given”、“that”和“request”是 RequestSpecification 的同步糖,您不需要它们来创建 RequestSpecification object。

package com.jayway.restassured 表明with()given()做同样的事情。

public static RequestSpecification with() {
   return given();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM