0

I have a groovy script in SOAP UI (ReadyAPI) that reads value from excel sheet, executes the operation and fetches the response. What I need is to write this response into the same .xls file.

How to write the value of SOAP response into existing excel sheet (.xls) using Groovy script?

RahulP
  • 1
  • 1

1 Answers1

0

You can add DataSink as a testStep and write the response to DataSink using groovy code.

def response = context.expand( '${login#Response}' )
new File( "C:/Users/eviware/" + currentUser + "_response.txt" ).write( 
response ) 
new File( "C:/Users/eviware/" + currentUser + "_response.txt" ).write( 
response, "UTF-8" ).

Then from DataSink dropdown select Excel and add the "File", "OutFile" and WorkSheet. Automatically It will write the things to Excel Sheet.