I have scenario like need to send REST POST API request multiple times with different data which is reading data dynamically from excel file, then take the testdata
from excel file using dataprovider and validate with multiple input request response data with testdata provider results using rest assured API assert.
I am facing issue when i am trying to run with dynamic multiple requests and validate response with testdata using dataprovider.
Not able to display test results for multiple request validations.
Below is the sample code for dataprovider test data and actual input requests data.
@Test(dataProvider = "data",dataProviderClass = TVDataProvider.class)
public void productListConstructionLoan(String closingid, String closingname, String id, String name,
String quantity, String source, String endrid, String endrname,
String polcovname)
throws JSONException, InterruptedException, FileNotFoundException, IOException, ParseException {
//Read multiple intput request records from excel file here
for (String recordId : readAllRecords.keySet()) {
String inputRequest = readAllRecords.get(recordId);
RestAssured.given().body(inputRequest).contentType("application/json").cookies(cookie).when()
.post(prop.getProperty("productlistURL")).then().assertThat()
.body("productlist.closingcosts.closingid", hasItem(Integer.parseInt(closingid))).and().assertThat()
.body("productlist.closingcosts.closingname", hasItem(closingname)).and().assertThat()
assertThat()
.body("productlist.policyproductgroup.policyproducts.policyname[0]", hasItem(polname)).and()
.assertThat()
.body("productlist.policyproductgroup.policyproducts.policycoveragename[0]", hasItem(polcovname));
}
}