Posts

Showing posts from April 8, 2018

API Testing with Rest Assured - Validating the json schema

Image
Sometimes you would get a json response while testing web applications. To make sure that all fields are present, but at the same time keeping the tests generic, you might write something like this given below.(although, a newbie way of writing tests)  @Category(RegressionTests.class)     @Test     public void verifyResponseByValidatingPresenceOfAllFields() {         given().                 param("product", "HomeLoan").                 param("fromHomeLoanId", -100).         when().                 get("/loans").         then().                 statusCode(200).                 contentType(ContentType.JSON).                 body(containsString("loans"))....