I am trying to return a map from dataprovider method in testng while reading excel using Apache POI framework.
The code I have written is this
@DataProvider(name="dp")
public Object[][] getExcelData(String testcaseID)throws IOException {
loadExcelDataFile();
Row row=sheet.getRow(returnMatchingRowData(testcaseID));
Row headerRow=sheet.getRow(0);
Map<String, String> map=new HashMap<String, String>();
for (int x=0; x<row.getLastCellNum(); x++) {
String key=headerRow.getCell(x).getStringCellValue();
String value=row.getCell(x).getStringCellValue();
map.put(key, value);
}
return new Object[][]{{map}};
}
@Test(dataProvider="dp")
public void test1(HashMap<String, String> map) throws IOException {
Object[][] ob=getExcelData("TC_001");
System.out.println(map.get("EmpName"));
System.out.println(ob.length);
}
I am getting following error
org.testng.TestNGException:
Some DataProvider public java.lang.Object[][] com.orangehrm.meta.utils.ExcelUtils.getExcelData(java.lang.String) throws java.io.IOException parameters unresolved: at 0 type class java.lang.String