replace tag value with content from file
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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-groo...
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Found a way; in addition to writing the desired value to a property I created a new test step of the type "Property Transfer" that injects it into the xml.
Took ages to find I lost much time trying to replace the xml content directly.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please explain in detail how to replace tag element in xml.
Actual problem statement is:
URL tag from 10 xml has to be replaced from 10 other xml through soap ui as i have to check response of each using wsdl link.
It would be very helpful if you explain looping these xml to replace element value
