[英]In rest assured framework,I am sending path params in one request but they are being send with another request as well. How can we remove path params?
@Test(description = "Verify that user is able to login and get the offer details for a particular promo code", dependsOnGroups = "getAuthKey")
public void verify_offers_with_login_with_promo_code() {
Map<String, String> headers = InputRequestHelper.setHeaders("auth_api_key", auth_api_key);
**// Have to remove the below set path parameters later in the code**
requestSpecification.pathParam("promocode", "1909");
Response response = InputRequestHelper.createGetRequest(requestSpecification, captor,
Constants.OFFER_PROMOCODE_PATH, headers, "com.dhani/schemas/offers/offersPromocode.json");
CommonHelper.writeRequestAndResponseInReport(writer.toString(), response.prettyPrint());
JSONObject jsonObject = new JSONObject(response.getBody().asString());
AssertionHelper.assertNotNull(ParseDynamicJson.getKey(jsonObject, "data"), "data");
AssertionHelper.assertFieldValue(ParseDynamicJson.getKey(jsonObject, "message"), "success", "message");
}
There is no way remove config in RequestSpecification
--> no way to re-use this.无法删除
RequestSpecification
中的配置 --> 无法重用它。 You have to create new instance of this class for every request.您必须为每个请求创建此 class 的新实例。
Similar situation here: https://stackoverflow.com/a/69569031/7574461类似情况: https://stackoverflow.com/a/69569031/7574461
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.