Forum Discussion

Manimaran's avatar
Manimaran
Occasional Contributor
12 years ago

How to write test request and response in Excel

Hi,

I have the groovy code for fetching the data from excel and running in test suite. But after each test case run, i dont have idea on writing the each executed test request and response in the excel against each test case row (last cell or column of the row). I am new to Groovy, can any one help me with the code please...?
  • Manimaran's avatar
    Manimaran
    Occasional Contributor
    Thanks for the information. But i am not able to write it to excel. I use the below code for read from excel and set it in the sopaui property.
    ----------------
    import org.apache.poi.hssf.usermodel.*;
    dFormatter = new HSSFDataFormatter()
    srcBook = new HSSFWorkbook(new FileInputStream(new File("...\\TestData.xls")))
    fEval = new HSSFFormulaEvaluator(srcBook)
    sourceSheet = srcBook.getSheetAt(0)
    context.rowCounter = 0
    sourceRow = sourceSheet.getRow(0)
    elNameCell = sourceRow.getCell(0)
    testCase.setPropertyValue("ElName",dFormatter.formatCellValue(elNameCell,fEval))
    -----------
    after execution, i am not able to write the executed request and response into the same excel file and inturn into the last column of same row. Could you please help me with the code?. I would appreciate if i get the full code for writing.