Forum Discussion

cbyndr's avatar
cbyndr
Contributor
15 years ago

xmlHolder for requests from other test cases

Is there a way to use xmlholder to get at some xml from another test case, and set values in that request?

i.e., test case A has a groovy script

test case B has a collection of XML test requests.

How can test case A's groovy script set values in the XML from test case B?

2 Replies

  • Using the following:

    def step = testRunner.testCase.testSuite.project.testSuites["TestSuite"].testCases["TestCase"].testSteps["testStep"]
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder (step.testRequest.requestContent)

    It is possible to get node values, as follows:

    value = holder.getNodeValue(//v1:Request[1]/v1:Id[1]")

    But I have had no success with setting node values. I have tried:

    holder.setNodeValue("//v1:Request[1]/v1:Id[1]", "2")

    And

    holder["//v1:Request[1]/v1:Id[1]"] = "2"

    To no avail