Clone Datasource using groovy script
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Clone Datasource using groovy script
I have a datasource using internal datagen and another datasource using groovy. I want to trasnfer complete datasource 1 to datasource 2. Baiscally make a copy. How can I achieve this using groovy?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you say you want to copy datasource 1 to datasource 2, what do you mean?
Do you want to replace DataSource 2 with data source 1?
Or do you want to copy the properties from Data Source 1 to Data Source 2?
Or do you want to make a brand new copy of Data Source 1?
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bear with me, I am still trying to understand what you are trying to do.
DataSource1 : Internal Datagen.
DataSource2: Dynamic datasource
DataSource3: Groovy datasource
Based on a condition, you want to alter DataSource 2 to either be DataSource 1 or DataSource 3? Is that the use case you are trying to figure out?
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@groovyguyThanks for your prompt replies. Let me make it simple, Use case is
Datasource1: using datagen multiple properties multiple rows
Datasource2: using datagen mulitple properties multiple rows
Datasource3: using groovy. This one will be dynamic and condition will be inside this datasource
For example : Datasource 3 with groovy will look like
if(x = 1)
Datasource 3 = Datasource 1
else
Datasource 3 = Datasource 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think what you want is possible, but not in the way you want. For the groovy script datasource, you could likely copy properties from either of the other two datasource based on a condition, but this will get complex really quickly if DataSource1 and DataSource2 have varying different properties.
What about the following:
- DataSource1 (DataGen)
- DataSource2 (DataGen)
- Groovy Script test step:
- Condition to decide which DataSource to use
- Based on condition, it will copy the setup of either DataSource1 or DataSource2 to DataSource3
- DataSource3 (DataGen)
Using a DataSource - Groovy test in DataSource3 would require you to basically completely code out the datagen steps you want to use from DataSource 1 or 2, or how to get data from them. The way I present would re-use the same. Does that sound feasible?
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the properties are same in all three so that is not the problem. The values and number of rows changes. What you are suggesting is also feasible, just need datasource to reflect src 1 or src 2.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@groovyguy : please can you assist with the groovy script for your suggestion. I want to copy whole data source and I am not able to iterate through rows.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll see if I can work out a groovy script to do this. It may take a bit.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I found a work around for this. I used groovy script to set data in property step. Added a property "rows" in property step which would determine the number of rows in datasource. Used this propery in number of rows field of datasource. This let me manipulate the datasource upto some extent.
