@AfterClass public void afterClass() throws Exception { // Printing logs to end the test case Log.endTestCase(sTestCaseName); // Closing the opened driver driver.close(); // Closing the opened excel file ExcelUtils.closeExcelFile(); }
// This method is to write in the Excel cell, Row num and Col num are the parameters @SuppressWarnings("static-access") public static void setCellData(String Result, int RowNum, int ColNum, String path, String sheet) throws Exception { try { Row = ExcelWSheet.getRow(RowNum); Cell = Row.getCell(ColNum, Row.RETURN_BLANK_AS_NULL); if (Cell == null) { Cell = Row.createCell(ColNum); Cell.setCellValue(Result); } else { Cell.setCellValue(Result); } // Constant variables Test Data path and Test Data file name FileOutputStream fileOut = new FileOutputStream(path); ExcelWBook.write(fileOut); fileOut.flush(); fileOut.close(); ExcelUtils.closeExcelFile(); ExcelUtils.setExcelFile(path, sheet); } catch (Exception e) { throw (e); } }