Forum Discussion

Jason1's avatar
Jason1
New Contributor
6 years ago

How to write test result to excel file

I need to write the test result (Pass / Fail) to my test data file.

In my test data file, every 4 rows is one request, so I need to write one test result every 4 rows.

That means I need to know which row to wirte the test result.

There are 2 ways to do this as I know so far:

1. use POI to write the excel file, but I get error CTExtensionList. I don't find a way to fix it yet

2. use datasink context pointer. I don't know if SoapUI has this function or not. Can we write mutiple rows to output excel file (DataSink) in one groovy script step? I mean if we can write one row of Excel file, then move to next row in one step?

 

Thanks

5 Replies

  • Hi Jason1,

     

    In my way using of POI or JXL will be a good approach, as you can moulde your groovy code according to your need.

    If you are facing any issue with groovy code please attach a screenshot of error, may be we can help.

     

     

    • Jason1's avatar
      Jason1
      New Contributor

      This is the code I used in SoapUI:

       

      def filePath = "C:/Work/Data/Sasktel/Commercail Wireless/1. Internal Flags/OR/OR-ICT00345.xlsx"

      FileInputStream inputStream = new FileInputStream(new File(filePath));

      XSSFWorkbook workbook = new XSSFWorkbook(inputStream);

      XSSFSheet sheet = workbook.getSheetAt(0);

      rowNumInt = rowNumInt + 1

      Row row = sheet.createRow(rowNumInt);

      Cell cell = row.createCell(25);

      cell.setCellValue(result);

      inputStream.close();

       

      FileOutputStream outputStream = new FileOutputStream(filePath);

      workbook.write(outputStream);

      workbook.close();

      outputStream.close();

       

      This is the exception I get:

       

      ERROR:java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList
      java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList

       

      Do you have a solution to fix this?

      Thanks