forum.venkateswarlu.net
      Register      Login
http://functionaltestautomation.blogspot.in/2009/10/dataprovider-data-driven-testing-with.html

1 replies to this topic

Pavan Ghanta #1
Member
18 Points
Posted on 25 Dec 2012 07:19 AM IST public String [][] gettable(String xlFilePath,String sheetName,String tableName) throws BiffException, IOException
 {
     String [][] tabArray= null;
    
     Workbook workbook = Workbook.getWorkbook(new File(xlFilePath));
     Sheet sheet= workbook.getSheet(sheetName);
     int startRow,startCol,endRow,endCol,ci,cj;
     Cell tableStart = sheet.findCell(tableName);
     startRow=tableStart.getRow();
     startCol=tableStart.getColumn();
     Cell tableEnd = sheet.findCell(tableName, startCol+1,startRow+1, 100, 64000,  false);               

     endRow=tableEnd.getRow();
     endCol=tableEnd.getColumn();
     System.out.println("startRow="+startRow+", endRow="+endRow+", " +"startCol="+startCol+", endCol="+endCol);
     tabArray=new String[endRow-startRow-1][endCol-startCol-1];
     ci=0;
     for (int i=startRow+1;i<endRow;i++,ci++)
     {
         cj=0;
         for (int j=startCol+1;j<endCol;j++,cj++)
         {
             tabArray[ci][cj]=sheet.getCell(j,i).getContents();
         }
     }    
    
     return(tabArray);
 }
 
 
    
    
    
    public static void main(String[] args) throws Exception {
        // TODO Auto-generated method stub
        String sDatapool="";
        String sTableName="Data";
        String sStartingCell="point";
         /*Object[][] retObjArr=ReadExcell.gettable(sDatapool,sTableName,sStartingCell);*/
        ReadExcell oEx = new ReadExcell();
        Object[][] retObjArr=oEx.gettable(sDatapool,sTableName,sStartingCell);
        System.out.println(retObjArr);
        System.out.println("Reading data from excell is complete");
       
    } 
Other     1025 views     Reply to this topic
Cherukuri Venkateswarlu #2
Member
140 Points
Replied on 28 Dec 2012 06:45 AM IST Hi Pavan,

Please add a descriptive title for your posts instead of giving URLs in Post Title. You can add the URLs in description of posts.

If we don't have relevant title for posts, it is hard to filter posts while searching for posts.

Thanks
Venkateswarlu Cherukuri
 
Reply to this topic