File not found exception: Apache poi - dataProvider -
---data provider class---
public class testdata { @dataprovider(name = "data") public static object[][] gettablearray() throws exception { file src = new file("d:/data/data.xlsx"); fileinputstream fis = new fileinputstream(src);//getting error line workbook wb = new xssfworkbook(fis); sheet sh = wb.getsheet("credentials"); int rowcount = sh.getlastrownum(); string[][] cred = getcelldata(sh,rowcount); system.out.println(cred[0][0]); return cred; } public static string[][] getcelldata(sheet sh, int rowcount){ int ri=0,ci=0; cell cell=null; string data[][]=null; int colcount = 2; for( ri=0;ri<=rowcount;ri++){ (ci=0;ci<colcount;ci++){ cell = sh.getrow(ri).getcell(ci); data[ri][ci]=cell.getstringcellvalue(); } system.out.println(cell); } return data; }
--accessing class----
public class data { @test(dataprovider="data", dataproviderclass = testdata.class ) public void read(string username, string password) { system.out.println(username); system.out.println(password); } }
this code getting error on line have added comment. error : java.io.filenotfoundexception: ?d:\data\data.xlsx (the filename, directory name, or volume label syntax incorrect)
Comments
Post a Comment