Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

total / count items from list json response

im trying to get count / total number of records from list api using Restassured.

Please share thoughts on how can we get it.

ex:

{
    "final list": [
        {
            "id": 123,
            "name": "sachin"
        },
        {
            "id": 234,
            "name": "sourav"
        }
    ]
}

I am expecting total as 2 here. please suggest.

like image 399
dileepvarma Avatar asked Nov 24 '25 08:11

dileepvarma


1 Answers

I got answer to my question.

here is the code for rest assured

expect().body("final_list.findall.size()",equalTo(2)).when().get("/list.json);

thanks

like image 100
dileepvarma Avatar answered Nov 25 '25 20:11

dileepvarma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!