Hi,
Im trying to parse SOAP response and write response values into an excel workbook so as to use the data for the next test case. So far ive written this custom keyword that works. But the problem is that this keyword cannot be reused as i have explicitly declared the locator of the element value in the code(hard-coded).
@Keyword
def void writePiNToExcel(ResponseObject response, String locator, int row, int column){
String xml = response.responseBodyContent
def request = new XmlSlurper().parseText(response.responseBodyContent)
String pin = request.Body.GenOTPResponse.Password
FileInputStream file = new FileInputStream (new File(“C://Users/tmwaura1/git/CBSWebservices/Data Files/Test Data Sfc App.xlsx”))
XSSFWorkbook workbook = new XSSFWorkbook(file);
XSSFSheet sheet = workbook.getSheetAt(2);
Cell searchText = sheet.getRow(row).getCell(column);
searchText.setCellValue(pin);
file.close();
FileOutputStream outFile =new FileOutputStream(new File(“C://Users/tmwaura1/git/CBSWebservices/Data Files/Test Data Sfc App.xlsx”));
workbook.write(outFile);
outFile.close();
}
How can i make use of the inbuilt katalon functions to parse response object and the the locator and get the value to write to excel.
Thanks