cancel
Showing results for 
Search instead for 
Did you mean: 

HI i need to setup datasink using groovyscript

SOLVED
Highlighted
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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Staff

Re: HI i need to setup datasink using groovyscript

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

 

- You can pickup your files with a DataSink type directory: e.g. https://www.soapui.org/docs/data-driven-tests/using-files.html

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

http://blog.smartbear.com/api-testing/how-to-use-xml-datasources-for-response-processing-in-soapui/

 

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

 

 

View solution in original post

7 REPLIES 7
Highlighted
Frequent Contributor

Re: HI i need to setup datasink using groovyscript

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?

Highlighted
Occasional Contributor

Re: HI i need to setup datasink using groovyscript

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.

 

Project1

TestCase1

Teststep1

Datasink

GroovyScript

 

 

Project2

TestCase1

 

TestCase2

 

TestCase3

 

 

 

 

 

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

 

 

Highlighted
Community Hero

Re: HI i need to setup datasink using groovyscript

Good that you mentioned you are familiar with java.

You may use the below javadoc to do the same.

http://www.soapui.org/apidocs/pro/index.html

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


Regards,
Rao.
Highlighted
Occasional Contributor

Re: HI i need to setup datasink using groovyscript

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.

Highlighted
Staff

Re: HI i need to setup datasink using groovyscript

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.  

 

Regards,

Mike Giller

Highlighted
Occasional Contributor

Re: HI i need to setup datasink using groovyscript

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>

<tag2>Jenny</tag2>

<tag3>Michael</tag3>

random tags here

 

Filename: XML2.XML

random tags here

<tag1>Rita</tag1>

<tag2>Michel</tag2>

<tag3>Mat</tag3>

random tags here

 

Filename: XML3.XML

random tags here

<tag1>Adam</tag1>

<tag2>Betty</tag2>

<tag3>Catlin</tag3>

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

 

 

Highlighted
Staff

Re: HI i need to setup datasink using groovyscript

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

 

- You can pickup your files with a DataSink type directory: e.g. https://www.soapui.org/docs/data-driven-tests/using-files.html

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

http://blog.smartbear.com/api-testing/how-to-use-xml-datasources-for-response-processing-in-soapui/

 

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

 

 

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors