import jxl.*
import jxl.write.*
//to read from excel
Workbook excelFile= Workbook.getWorkbook(new File("c:\\Testing\\test.xls"));
Sheet sheet = excelFile.getSheet(0)
//declaring map
def getTestDataMap = [:]
rows = sheet.getRows();
for( tc_row in 1..rows-1){
Cell testCase = sheet.getCell(0,tc_row);
Cell customerId = sheet.getCell(1,tc_row);
Cell productId = sheet.getCell(2,tc_row);
Cell productStatus = sheet.getCell(3,tc_row);
Cell propertyName = sheet.getCell(4,tc_row);
Cell propertyValue = sheet.getCell(5,tc_row);
String testCaseNumber = testCase.getContents();
getTestDataMap.put(testCaseNumber,new GetOperationBO(testCaseNumber: testCase.getContents(),customerIdData:customerId.getContents(),productIdData: productId.getContents(),productStatusData:productStatus.getContents(),propertyNameData:propertyName.getContents(),propertyValueData:propertyValue.getContents()))
}
excelFile.close()
// iterating
for ( e in getTestDataMap ) {
GetOperationBO getOperationBO = new GetOperationBO();
getOperationBO.testCaseNumber = e.key
getOperationBO = e.value
log.info getOperationBO.testCaseNumber
log.info getOperationBO.customerIdData
log.info getOperationBO.productStatusData
}
class GetOperationBO {
String testCaseNumber
String customerIdData
String productIdData
String productStatusData
String propertyNameData
String propertyValueData
}
import jxl.write.*
//to read from excel
Workbook excelFile= Workbook.getWorkbook(new File("c:\\Testing\\test.xls"));
Sheet sheet = excelFile.getSheet(0)
//declaring map
def getTestDataMap = [:]
rows = sheet.getRows();
for( tc_row in 1..rows-1){
Cell testCase = sheet.getCell(0,tc_row);
Cell customerId = sheet.getCell(1,tc_row);
Cell productId = sheet.getCell(2,tc_row);
Cell productStatus = sheet.getCell(3,tc_row);
Cell propertyName = sheet.getCell(4,tc_row);
Cell propertyValue = sheet.getCell(5,tc_row);
String testCaseNumber = testCase.getContents();
getTestDataMap.put(testCaseNumber,new GetOperationBO(testCaseNumber: testCase.getContents(),customerIdData:customerId.getContents(),productIdData: productId.getContents(),productStatusData:productStatus.getContents(),propertyNameData:propertyName.getContents(),propertyValueData:propertyValue.getContents()))
}
excelFile.close()
// iterating
for ( e in getTestDataMap ) {
GetOperationBO getOperationBO = new GetOperationBO();
getOperationBO.testCaseNumber = e.key
getOperationBO = e.value
log.info getOperationBO.testCaseNumber
log.info getOperationBO.customerIdData
log.info getOperationBO.productStatusData
}
class GetOperationBO {
String testCaseNumber
String customerIdData
String productIdData
String productStatusData
String propertyNameData
String propertyValueData
}