MoUddin
7 years agoContributor
Could the static xml forms be edited through groovy within the response script?
Based on the examples, posted here:
Do you think this would be possible without a physical file?
ie in the ServiceV scenario, could the static xml forms be edited through groovy within the response script?
Sorry for stacking the questions, but would this need to be achieved through XmlSlurper on
requestContext.mockResponse.responseContent
or something like that?
My final question is how would I then save the changes to the edited response to send back through the virt? - I assume .responseContent only returns an instance of the response and does not allow you to edit the actual response itself.
Thanks in advance,
Mo
- Ok so first you definitely can edit xml strings using the same code I posted above. I think you need to use the method 'parseText()' instead of 'parse' though...
As for the other question... you can save the edited xml into a property and then use that value. I also wrote some article about properties few days ago.
I'm on the phone right now but let me know if you need more help!