I have the following class
pulbic class DataProiders {
@DataProvider(name="data")
public String[][] getAllData() throws IOException {
// Using XLUtils class which uses XSSWorkbook to get cell data
//Take the name of the xls file and sheet name and calculate row and column count
//two for loops rowcount and columncount to get all data and return the data
}
//I have the test clsss test.java
public class CutomerRecords {
pulbic Response response;
public static JSONObject resJsonObj;
@Test(priority = 1, dataProvider = "data", dataProviderClass = DataProviders.class)
public void CustomerData(String cId, String fName, String lName, String email, String postCode){
//These are the 5 columns in the xls sheet
//set method to set all the parameters using pojo class for request
//Call the POST API and get the response back
response = PostMehtodFromAPIClass(request)
resJsonOj= new JSONObject(response.getBody().asString());
}
@Test(priority=2)
public void validateResponseCusID(){
//my validation logic using resJsonObj
}
@Test(priority=2)
public void validateResponseCusName(){
//my validation logic using resJsonObj
}
@Test(priority=2)
public void validateResponseCusPostCode(){
//my validation logic using resJsonObj
}
@Test(priority=2)
public void validateResponseCusEmail(){
//my validation logic using resJsonObj
}
Here, my requirement is first execute CustomerData for first row in xls sheet and continue the each validation responbse test functions, then read the second row and test validate resonse.
But what is happening is if I have 5 rows in xls, it executes 5 rows and only for last row the validation response functions are working. I need a suggestion to read one row at atime and call the validation functions, then second row and validations, and so on.