0
In Rest Assured , I send a get request and below Json response is received. 

//Json Response

{
  "data": [
    {
      "Name": "REST",
      "Description": "Representational state transfer"
    },
    {
      "Name": "SOAP",
      "Description": "Simple Object Access Protocol"
    }
  }
}

I want to validate if name is REST then description is Representational state transfer , if name is SOAP then description is Simple Object Access Protocol. There are more than 20 records like the same in response and how can I do it through rest assured using generic parameters.

Also please advise how to parameter and do the assertion otherwise it will lead to more than 20 line of assertions alone.
Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66

1 Answers1

0

Done as follows

given()
    .when().get(url)
    .then()
      .root("data")
      .root("find { it.Name == 'REST' }")
          .body("Description", equalTo("Representational state transfer");

Hope you get the idea.

SudhirR
  • 760
  • 4
  • 11