Ask a Question

HI i need to setup datasink using groovyscript

Occasional Contributor

HI i need to setup datasink using groovyscript

HI I have soapui pro 

I have a project with a large number of test cases.

Using groovy script i need to add a datasink test step to each test case which will write response values to excel.


I do not want to manually go and add datasink test step in each test case. 


So where do i start? 


Thanks in Advance.



Frequent Contributor

Ok, where you planning to add groovi script though?

I guess I am trying to understand the purpose of writing each response to excel before I can suggest something here.

I would recommend using datasink in case of need to produce mass data.

Other than that for automation why would you like you preserve each and every run results every time test runs on top of test logs and results?

Occasional Contributor

Hi testthrishi



I need to use the groovyscript in Project1 to clone the datasink step from Project1 into all of the test cases in Project2.




















Can this be done? I can hardly see any books online that teach this stuff? DO you know of any good resources? I am good with Java but i just am having trouble with groovyscript syntax for soapui



Champion Level 3

Good that you mentioned you are familiar with java.

You may use the below javadoc to do the same.

In fact you can even write a standalone program, read the existing project, add the step where you needed.

Occasional Contributor

Hi yes i am familiar with Java but am no expert. I did it back in Uni and i have no idea how to read that JavaDoc. it doesnt make sense to me.

I'm a little confused about why you try to dynamically clone the DataSink step to three testcases.


It'll likely take a couple of hours of trial and error coding to create that.  Whereas you can configure three datasink steps in a couple of minutes.  With that, I'm sure I'm missing something


Can you please define what is the goal you are trying to achieve?

Are you simply capturing responses?  If so, you'd be better off using events rather than datasink groovy cloning.


If you can describe what functionality you are trying to achieve, we can assist with the setup better.  



Mike Giller

Occasional Contributor

Sorry i wasnt clear enough before. I have Soap UI Pro




This is what i would like to do using soapui



1) Pick an XML response file from local drive on my computer.

2) Capture the response file values within the tags.

3) Verify that the response values from XML match to what is in excel sheet that is also locally saved.

4) Loop steps 1-3 for multiple XML responses to their corresponding excel records.


I need a dynamic setup for steps 1-4 because the XML file numbers and records in spreadsheet are different for each service. I have multiple services to work with. Each service has its own spreadsheet and its own xml responses.


For example:

For service 1: The excel spreadsheet data looks like:


Column 1                 Column 2 Column 3 Column 4


XML1.XML              John       Jenny     Michael

XML2.XML              Rita        Michel   Mat

XML3.XML             Adam     Betty      Catlin



The XMl response files for service 1 looks like:


Filename: XML1.XML

random tags here

<tag1>John </tag1>



random tags here


Filename: XML2.XML

random tags here




random tags here


Filename: XML3.XML

random tags here




random tags here


Aim: Ensure the values in response match the values in an excel row. Loop that through multiple files against corresponding excel rows. Both XML files and excel are stored locally.


I have been trying to figure this out for the last couple of days. Can this be done or am i just wasting my time? if you guys could set me on the right path id really appreciate it.







Thanks for expanding on this.  Here are some configurations that should help:


- You can pickup your files with a DataSink type directory: e.g.

- Then you can have a nested DataSource type XML where you could walk through repeating tags: e.g.


The one setup I'm not 100% on how you should map is the lookup against the Excel.  The way that data is structured with looping through columns will make it hard to be dynamic.  If you had a lightweight database instead of Excel, you could use a JDBC Test Step to do a SQL lookup



Showing results for 
Search instead for 
Did you mean: