Forum Discussion
Mike_M
17 years agoNew Contributor
Thanks again.
I ended up turning the rows of data into XML in a Groovy step, but I assigned it to a property, then used property expansion to place the relevant data in the request (see below.)
What I should do is read the list of properties from the DataSource and build the XML generically.
Groovy script:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def dataSource = testRunner.testCase.testSteps['DataSource']
def xml = ''
while( dataSource.next( testRunner, context ) )
{
xml += ''
xml += '' + groovyUtils.expand('${DataSource#OrderID}') + ' '
xml += '' + groovyUtils.expand('${DataSource#OrderName}') + ' '
xml += ' '
}
xml += ''
groovyUtils.setPropertyValue("Properties","xml", xml)
Request fragment:
${Properties#xml#//dataRow[1]/OrderID/text()}
${Properties#xml#//dataRow[1]/Name/text()}
${Properties#xml#//dataRow[2]/OrderID/text()}
${Properties#xml#//dataRow[2]/Name/text()}
I ended up turning the rows of data into XML in a Groovy step, but I assigned it to a property, then used property expansion to place the relevant data in the request (see below.)
What I should do is read the list of properties from the DataSource and build the XML generically.
Groovy script:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def dataSource = testRunner.testCase.testSteps['DataSource']
def xml = ''
while( dataSource.next( testRunner, context ) )
{
xml += '
xml += '
xml += '
xml += '
}
xml += ''
groovyUtils.setPropertyValue("Properties","xml", xml)
Request fragment:
Related Content
- 13 years ago
- 4 years ago
- 2 years ago
- 4 years ago
Recent Discussions
- 15 years ago