Forum Discussion

dmllc's avatar
dmllc
Occasional Contributor
14 years ago

assert xml dom

how would i go about asserting specific xml nodes are returned in the soap response? it seems that i have to use groovy script assertion, but i'm not too familiar with this language.

2 Replies

  • Aaronliu's avatar
    Aaronliu
    Frequent Contributor
    you would use xpath expression to compare.
    as for groovy script, it's simple to proceed:
    example:

    def a=1
    def b=2
    assert a+b == 3
  • You can assert your XML node value using below code.

    import com.eviware.soapui.support.XmlHolder
    def holder = new XmlHolder( messageExchange.responseContentAsXml )

    assert holder["//Node Xpath"] == "Node value"

    check above code....

    Thanks
    Sadik Ali