Forum Discussion

vivram's avatar
Occasional Contributor
7 years ago

Data Driven using SoapUI Open Source

Hi Guys,


I am using SoapUI free version tool.


I want to use a data driven testing having the below scenario:


1. Load the parameter from an excel sheet to Test Case

2. Write back the response parameter to the respective excel sheet


I have seen some posts using groovy script, but didn't find how to write back the response values to excel sheet.



4 Replies

  • Lucian's avatar
    Community Hero

    Can you give some more info? What do you mean by 'response parameter'? Where do you want to write it in the excel?

    • vivram's avatar
      Occasional Contributor

      I want a specific response xml value from the payload to be stored back in excel sheet for each of the input values supplied through looping.


      The response values need not write on same excel sheet in which Input values are supplied, but could be different one. Would be easier if it's on same excel sheet. looking to print in any column of excel sheet 



  • vivram's avatar
    Occasional Contributor

    I was able to successfully create inputs via external file and using counter


    check this link


    Haven't got my luck to get groovy script to record specific value of respnonse xml to an external file. Challenge is to record in looper. As I want to store each response in next line of xls file or .txt file.


    eg. want to record the below value of xml to external file with each response in new line





  • vivram's avatar
    Occasional Contributor

    Have cracked this Groovy Script for writing back response value to external file. Works well :smileyhappy:


    If your response xml looks like below:








    The below groovy script does the following actions
    1. Captures the xml response for test case
    2. Captures the xml node values with 'Cost' element
    3. Writes into a file and prints each results in next line (useful for looping) where we want to capture each results in next line

    def retrieve = groovyUtils.getXmlHolder("TestCaseName#Response" )
    def cost = retrieve.getNodeValues("//ns2:Cost").toString()

    new File( "C:/Projects/results.txt" ).append( cost + "\n")

    // You could view the value in log output if you want to cost