cancel
Showing results for 
Search instead for 
Did you mean: 

How to parameterize different fields in one single datasource

Frequent Contributor

How to parameterize different fields in one single datasource

Hi:

I read the user guide and couldn't find much info on using an external file as datasource.  Here is my scenerio:  I have three fields (firstName, lastName, displayName) that I want to parameterize 10 rows of values for each.  Do I need to create three separate datasources (1 datasource for 1 field) or can I do that in 1 single datasource?  If I am allowed to do that in 1 single datasource, I suppoose I need to add 3 properties in the datasource panel, firstName, lastName, displayName, respectively.  Then in the external text file (delimited by a comma), what is the format that I need to use so I can paramertize 10 values for each field?


Thanks,
Li Zhang
3 REPLIES 3
Super Contributor

Re: How to parameterize different fields in one single datasource

Hi Li,

Just so I understand your setup: do you want to run a request for each row in your data-file? In that case you are on the right track;

1) Create a DataSource with the 3 properties, then create rows in your file containing these 3 values separated with a comma.. for example:

John,Doe,John the Doe
Max,Roach,Cockroach
etc..

2) Create a request that contains property expansions for these properties.. for example if your request xml contains

..
..
..

Then you could enter

${DataSource#firstName}
${DataSource#lastName}
${DataSource#displayName}

(or create these with the corresponding wizards in the outline editor: http://www.soapui.org/userguide/functio ... zards.html)

3) Create a DataSource loop step with the DataSource step set to the one created above and the Target Step set to the request step

-> For each row in your external file, soapUI Pro will execute the request with the values from the file..

Hope I understood you correctly, just post again otherwise :-)

regards!

/Ole
eviware.com
Frequent Contributor

Re: How to parameterize different fields in one single datasource

Hi:

You understood it perfectly. 

Just to clarify, does the order of the values in the text file correspond to the order in which I add the properties?

For example, if the properties I added are in the following order
firstName
lastName
displayName

Then in the txt file:

John,Doe,John the Doe -- firstName
Max,Roach,Cockroach -- lastName
foo1, foo2, foo3 -- displayName

Thanks for your help,
Li
Super Contributor

Re: How to parameterize different fields in one single datasource

Hi,

exactly.. the order of the properties corresponds to the order of the values in the file..

regards!

/Ole
eviware.com
New Here?
Join us and watch the welcome video:
Top Kudoed Authors