Forum Discussion

metaAbhishek's avatar
metaAbhishek
New Contributor
10 years ago

Combine two responses

Hi,
I am new to SoapUI. I want to know , How to combine two responses into one and transfer it to other TestCases?

TestCase1:
<ResponeNode>
<Node1>SOAP</Node1>
<Node2>UI</Node2>
</ResponeNode>


I want to combine Node1 and Node2 like SOAP-UI and transfer this properties to other test case for further uses. I know how to transfer properties but do not know How to combine two responses.

Scenario is In TestCase2 it required request like 'SOAP-UI' (separated by - )

1 Reply

  • Cizo89's avatar
    Cizo89
    Frequent Contributor
    Hi,

    if it's just to combine 2 different elements from your xml, you can write a simple Groovy script for this:

    String xml = '''<ResponeNode>
    <Node1>SOAP</Node1>
    <Node2>UI</Node2>
    </ResponeNode>'''

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
    def holder = groovyUtils.getXmlHolder(xml)

    String name = holder["//Node1"] + "-" + holder["//Node2"]

    testRunner.testCase.testSuite.testCases["YOUR_TESTCASE"].setPropertyValue("name", name)


    If your response can returned more than Node1 and Node2, you'll have parse the response, for example using XmlParser.

    In case of any additional questions, feel free to ask

    Regards,
    Marek