Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rest Assured API difference b/t param() and queryParam()

I am using Rest Assured API Automation framework for API Testing and can anyone tell me difference between the methods param() and queryParam() which we use in get() and POSt() request.

like image 508
Jawad K. Avatar asked Jan 04 '18 09:01

Jawad K.


1 Answers

RESTassured request parameters can be either query parameters or form parameters.

If you don't specify which, RESTassured will assume GET params are query params and POST params are form params, e.g.

given()
    .spec(spec)
    .param("active", "True")
    .when()
    .post("save")
    .then()
    .statusCode(200);

will send form parameters in the body. If you require query parameters, you must use .queryParam("active", "true")

like image 71
Adam Avatar answered Sep 25 '22 05:09

Adam