2013-11-26 2 views
0

셀레늄을 사용하여 ERP 응용 프로그램을 테스트하고 있습니다. webdriver.i 결과를 Excel로 작성해야합니다. 각 단계에 대해 지금은 별도의 코드를 작성하여 Excel로 작성하고 있습니다. 거기에 7 개의 메인 모듈과 각각의 메인 모듈 10 하위 모듈은 내가 각 단계 유효성 검사에 대한 코드를 작성할 때 codesize 증가합니다. 내 현재 코드 : -동적 인 방식으로 여러 레코드를 작성하는 가장 좋은 방법은 무엇입니까?

나는 모든 여섯 개 값을 각 시간을 통과 할 수 있으며이

내 예상 코드를 Excel로 작성합니다 일부 Methos는 찾고 있어요 각 항목 를 들어

Label col12row9 = new Label(12,j,arlogin[3],getCellFormatnormal(redFont)); 
ws.addCell(col12row9); 
Label col0row9 = new Label(0, j,"ReqSmok"+i); 
ws.addCell(col0row9); 
Label col1row9 = new Label(1, j,"Browser Details"); 
Range col1row9r = ws.mergeCells(1,j, 5, j); 
ws.addCell(col1row9); 
Label col6row9 = new Label(6,j,"Get the Browser name "); 
Range col2row9r = ws.mergeCells(6,j, 11, j);  
ws.addCell(col6row9); 

이 같은 것입니다 -

private void ResulttoExcellabel(String[] ResulttoExcellabel) 
     throws IOException, InterruptedException, WriteException { 

    WritableSheet sheet1 = null; 
    FileOutputStream f1 = new FileOutputStream(
      "D:\\smoketest_AIM.xls"); 
    WritableWorkbook wwb = Workbook.createWorkbook(f1); 
    sheet1 = wwb.createSheet("result", 0); 
    Label l = new Label(1,7,"a[0]");sheet1.addCell(l); 
    Label l1 = new Label(1,7,"a[1]");sheet1.addCell(l1); 
    Label l2 = new Label(1,7,"a[2]");sheet1.addCell(l2); 
    Label l3 = new Label(1,7,"a[3]");sheet1.addCell(l3); 
    Label l4 = new Label(1,7,"a[4]");sheet1.addCell(l4); 
    Label l5 = new Label(1,7,"a[5]");sheet1.addCell(l5); 
    Label l6 = new Label(1,7,"a[6]");sheet1.addCell(l6); 

} 이 같은 모든 단계에서이 전화 : - ResulttoExcellabel (ResulttoExcellabelr); - 이 값은 해당 메서드에 모든 값을 전달한 다음 Excel 시트에 쓰고 workbook.write를 테스트 마지막에 수행해야합니다. 도와주세요. 감사합니다. .

답변

0

난 내 2 dimentional 초래할라고했다 (문자열 배열 루프 사용이 1 용액) 목록의 모든 결과를 얻을/문자열

2) 밖으로 일 [X] [Y]) 3) i 및 j로 cols와 행을 Excel에 다시 반복하고 결과를 썼습니다.

0
   for(y=9;y<arraynoofrows+9;y++) 
       { 
        testcaseid=testcaseid+1;  
        String testcaseid1 = String.valueOf(testcaseid); 
        col=0; 
        for(j=0;j<6;j++) 
        { 
         colnum=TestResultcolnumbers[col]; 
         Label l = new Label(colnum,y,ar[y-9][j]);ws.addCell(l); 
         System.out.println("value of colnum"+colnum+" value of row number"+y+" value of i "+y+" value of j"+colnum+"value of ar[i][j] "+ar[y-9][j]); 
         col=col+1; 
         System.out.println(colnum); 
        } 
       } 
관련 문제