Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Printing response using rest assured

Lobsang January 4, 2022

Hi, recently i started learning rest assured and I encounter strange behaviour.

Basically I created request to create boards with default param on defaultLists = true, then added another request to read from board and finally simple print to see response - every time on single print I get two identical prints of two list containing same items.

String boardName = "Board without lists";

Response creationResponse = given()
.queryParam("key", key)
.queryParam("token", token)
.queryParam("name", boardName)
.queryParam("defaultLists", true)
.contentType(ContentType.JSON)
.when()
.post(url)
.then()
.statusCode(HttpStatus.SC_OK)
.extract()
.response();

JsonPath jPathPost = creationResponse.jsonPath();
idBoard = jPathPost.get("id");

Assertions.assertEquals(boardName, jPathPost.get("name"));

Response getResponse = given()
.queryParam("key", key)
.queryParam("token", token)
.contentType(ContentType.JSON)
.when()
.get(url + "/" + idBoard + "/lists")
.then()
.statusCode(HttpStatus.SC_OK)
.extract()
.response();

System.out.print(getResponse.print());

Any idea why on console I receive two same lists? Checked on postman with same request and i got normal response with one list.

 

Thanks in advance!

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events