I am trying to fetch the values from excel sheet using data provider with hash map.For now I can read the entire rows from the excel sheet.The excel sheet has 3 columns "TestcaseId","Testdata","scriptname".Here I need to pass the script name as a paramater to the test method from data provider.Please help me how to achieve this.Below is the dataprovider code using hashmap
@DataProvider(name="cbndataprovider")
public static Iterator<Object[]> cbntestdata() throws IOException
{
List <Object[]> alist = new ArrayList<Object[]>();
OriginalExcelRW Excel = new OriginalExcelRW("F:\\anand_acer\\selenium\\cbnindia1\\Test_Data_Sheet.xlsx");
XSSFSheet s = Excel.Setsheet("Test_Data");
int rowcount = s.getLastRowNum();
for(int i =1;i<=rowcount;i++)
{
Object[] obj = new Object[1];
Map<String,String>hm=new HashMap<String,String>();
hm.put(Excel.Readvalue(s, 0, 0), Excel.Readvalue(s, i, 0));
hm.put(Excel.Readvalue(s, 0, 1), Excel.Readvalue(s, i, 1));
hm.put(Excel.Readvalue(s, 0, 2), Excel.Readvalue(s, i, 2));
hm.put(Excel.Readvalue(s, 0, 3), Excel.Readvalue(s, i, 3));
System.out.println(Excel.Readvalue(s, 0, 0)+"...."+ Excel.Readvalue(s, i, 0));
System.out.println(Excel.Readvalue(s, 0, 1)+"...."+ Excel.Readvalue(s, i, 1));
System.out.println(Excel.Readvalue(s, 0, 2)+"...."+ Excel.Readvalue(s, i, 2));
System.out.println(Excel.Readvalue(s, 0, 3)+"...."+ Excel.Readvalue(s, i, 3));
obj[0]=hm;
alist.add(obj);
}
return alist.iterator();
}
}