Forum Discussion

Brandon_Tucker's avatar
Brandon_Tucker
Occasional Contributor
16 years ago

Problems modifying an xml request in another TestSuite

I am trying to modify the xml of a request that lives in a complete other TestSuite. I know how to access the request in another TestSuite and execute it, but it will not allow me to modify the xml of the request. I currently have the request in the same TestStep as the groovy script that  modifies the request and then runs it. For the time being, I have the following, but I would really like to move all the requests to a different TestSuite.


def testStep = testRunner.testCase.testSteps[testStepName]
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder(testStep.name+"#Request")

holder.setNodeValue("//aps:StreetNumber", address)

holder.updateProperty()


When I try and set testStep to the TestStep in the other TestSuite that contains the same request I get a null pointer exception on groovyUtils.getXmlHolder(testStep.name+"#Request"). I know there is probably something I am missing, but please help.

Thanks,
Brandon

1 Reply

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    You can only initialize the holder with a property-reference if that property is in scope (ie if you could get at it with context.expand), in your case the property is in another testsuite/testcase which will require you to

    def holder = groovyUtils.getXmlHolder( testStep.testRequest.requestContent )

    .. modify ..

    testStep.testRequest.requestContent = holder.xml


    Hope this helps!

    regards,

    /Ole
    eviware.com