craigcanderson
15 years agoContributor
XPath Match Assertion Failing
Background
I'm using soapUI Pro 3.6.1. When my test case executes the XPath Match assertion always has a status of "FAILED". If I double click on the assertion to open it up, and press the "Test" button, I get a message box titled "Success" with the message "Response matches content for [declare namespace...]" and the status changes to "SUCCESS". I'm allowing wildcard characters ('*') to be used. The response is XML, with one node containing EDI information that has been replaced with the wildcard character '*' (<EDIData>*</EDIData>) and another node containing XML "wrapped" within a CDATA tag (<XMLData><![CDATA[[xml_data]]></XMLData>).
For the node "wrapped" in a CDATA tag, I've created an event handler (SubmitListener.afterSubmit) with the associated code of:
if( submit.response == null )
return
def content = submit.response.responseContent
content = content.replaceAll("<!\\[CDATA\\[", "")
content = content.replaceAll("]]>", "")
log.info(content)
submit.response.responseContent = content
to "strip" off the "<![CDATA[" and "]]>" string pieces from the response XML associated with the XMLData node. As part of the XPath Match assertion for this node, the wildcard character '*' is being used for date and time values that will change from execution to execution.
Questions
I've never had this problem in the past using the XPath Match assertion.
I'm using soapUI Pro 3.6.1. When my test case executes the XPath Match assertion always has a status of "FAILED". If I double click on the assertion to open it up, and press the "Test" button, I get a message box titled "Success" with the message "Response matches content for [declare namespace...]" and the status changes to "SUCCESS". I'm allowing wildcard characters ('*') to be used. The response is XML, with one node containing EDI information that has been replaced with the wildcard character '*' (<EDIData>*</EDIData>) and another node containing XML "wrapped" within a CDATA tag (<XMLData><![CDATA[[xml_data]]></XMLData>).
For the node "wrapped" in a CDATA tag, I've created an event handler (SubmitListener.afterSubmit) with the associated code of:
if( submit.response == null )
return
def content = submit.response.responseContent
content = content.replaceAll("<!\\[CDATA\\[", "")
content = content.replaceAll("]]>", "")
log.info(content)
submit.response.responseContent = content
to "strip" off the "<![CDATA[" and "]]>" string pieces from the response XML associated with the XMLData node. As part of the XPath Match assertion for this node, the wildcard character '*' is being used for date and time values that will change from execution to execution.
Questions
- Why do I have to open the assertion each time and press the "Test" button to get the assertion to pass?
- Is there something that I have to configure so that automatically upon the completion of test case execution the functionality associated with the "Test" button is executed?
I've never had this problem in the past using the XPath Match assertion.