Forum Discussion
M_McDonald
15 years agoSuper Contributor
I have used a Datasource / Datasource Loop with a Groovy step between which appended the Datasource elements to a property, then used the property after exiting the loop.
Resulting XML in Properties#XmlFragment:
There are other ways to do this in script but this is pretty simple.
def gu = new com.eviware.soapui.support.GroovyUtils( context )
def countryCode = context.expand( '${DataSource#CountryCode}' )
def countryName = context.expand( '${DataSource#CountryName}' )
def frag = context.expand('${Properties#XmlFragment}')
gu.setPropertyValue('Properties', 'XmlFragment', "${frag}<country><code>${countryCode}</code><name>${countryName}</name></country>" )
Resulting XML in Properties#XmlFragment:
US
United States FI
Finland
There are other ways to do this in script but this is pretty simple.
Related Content
- 3 years agoMoUddin
- 3 years agoLucian
- 4 years agomehdisinger