enliven
17 years agoContributor
Script Assertion with messageExchange
Hello,
Im curious why I must assign values to a var before asserting, instead of asserting the value from the type?? what am I not doing right?:
Im curious why I must assign values to a var before asserting, instead of asserting the value from the type?? what am I not doing right?:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def req = groovyUtils.getXmlHolder( messageExchange.requestContent )
def res = groovyUtils.getXmlHolder( messageExchange.responseContent )
req.namespaces["ns"] = "http://xyz"
res.namespaces["ns"] = "http://xyz"
//this DOES NOT work
//assert req["//ns:ResponseHeader/ns:RequestId"] == res["//ns:ResponseHeader/ns:RequestId"], "RequestID differs"
//this DOES work
def reqid = req["//ns:RequestHeader/ns:RequestId"]
def resid = res["//ns:ResponseHeader/ns:RequestId"]
assert reqid == resid, "RequestID differs"