Forum Discussion
SmartBear_Suppo
16 years agoSmartBear Alumni (Retired)
Hello!
The easiest way of doing this would be by using XPath assertions, but it is possible to do it in a script assertion as well. Try the following script:
You may have to change the namespace prefixes, depending on what the rest of your response looks like. You may also want to change the XPath expressions to be more specific, if the response contains multiple DashboardModules or something. Good luck!
Regards,
Dain
eviware.com
The easiest way of doing this would be by using XPath assertions, but it is possible to do it in a script assertion as well. Try the following script:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder(messageExchange.responseContentAsXml)
assert holder.getNodeValue("//ns1:ModuleCode") == "REC_HL_FAMILY"
assert holder.getNodeValue("//ns1:ProfileId") != "7"
You may have to change the namespace prefixes, depending on what the rest of your response looks like. You may also want to change the XPath expressions to be more specific, if the response contains multiple DashboardModules or something. Good luck!
Regards,
Dain
eviware.com