I have this error when I ran this test. For the previous test file, it ran perfectly.
@DataProvider(name = "login")
public Object[][] loginData() throws BiffException, IOException {
Object[][] arrayObject = testDataXls.getExcelData(
System.getProperty("user.dir") + "\\src\\test\\resources\\testdata\\Input_TestData.xls",
this.getClass().getSimpleName());
return arrayObject;
}
Here the getExcelData I used
public String[][] getExcelData(String fileName, String sheetName)
throws BiffException, IOException {
String[][] arrayExcelData = null;
FileInputStream fs = new FileInputStream(fileName);
Workbook wb = Workbook.getWorkbook(fs);
Sheet sh = wb.getSheet(sheetName);
int totalNoOfCols = sh.getColumns();
int totalNoOfRows = sh.getRows();
arrayExcelData = new String[totalNoOfRows - 1][totalNoOfCols];
for (int i = 1; i < totalNoOfRows; i++) {
for (int j = 0; j < totalNoOfCols; j++) {
arrayExcelData[i - 1][j] = sh.getCell(j, i).getContents();
}
}
return arrayExcelData;
}
I don't know why it didn't perform as the previous test file. And the error is highlighting on the Object[][] arrayObject = testDataXls.getExcelData(