replace tag value with content from file
Hello,
I am trying to automate testing of a web service by filling in tags in my request(s) with values coming from a file. Since the "Data Source" test step is not available in SoadUI open source I am trying to implement groovy scripts as described in https://learnsoapui.wordpress.com/2012/05/19/groovy-datasource-teststep-dataloop-teststep-using-groovy-in-soapui/
This works actually quite well; I can read all values in my file and the values are written into the Property - Looper / Value field in a successive manner. However, the script does not actually update the xml of my mock request; I could not even find a statement that tries it.
I wanted to use a statement like this which should replace the content of the the tag ltNomenclature with the value read from file present in the tempValue variable:
def node = xml.'testCase'.findAll { it.name() == 'ltNomenclature' }.each{ it.replaceBody(tempValue) }
However, this is not all that is needed, xml must be defined beforehand. How can I do this to make it reference my mock request ? All examples that I found in the forums concern parsing xml from file using xmlslurper but not from within the test case suite itself.
Many thanks for any hints you could give. Cheers, Uwe