DEV Community

Mert çevik
Mert çevik

Posted on

3 2

How To Use Response value In Another Method

0

I am working on restassured and here is my 2 methods. I want to use the albumId returned from the AlbumList method in the other method

public void AlbumList() {
    Response response1 = given().spec(url).queryParam("page", 0).queryParam("size", 100)
            .queryParam("sortBy", "createdDate").queryParam("contentType", "album/photo")
            .queryParam("sortOrder", "ASC")
            .header("Content-type", "application/json")
            .header("Accept", "application/json")
            .header("X-Auth-Token", payload.userAuth())
            .when().get("/album")
            .then().assertThat().statusCode(200).extract().response();


    Assert.assertEquals(response1.jsonPath().get("[4].label"),

Hello could you please help me ? Thank you

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay