Forum Discussion
SmartBear_Suppo
Alumni
12 years agoHi,
As a workaround I've modified the response in a test case I setup using an event handler RequestFilter.afterRequest. Code is below, modify it to replace the test case name, namespaces, and xpath's with what you are using.
I put this data (12649064,U|289843,D|274039,A|73611,S|34,P|2,PL)(SCIDIR,CON|38c1-4a9fdb5734147598f96-bbc86d9af2d396ab-O,SSO|REG_IP,ACCESS_TYPE) in a <price> element using a mock service and took out the 38c* data so the result is (12649064,U|289843,D|274039,A|73611,S|34,P|2,PL)(SCIDIR,CON|,SSO|REG_IP,ACCESS_TYPE) to compare against using a XPath match assertion.
Attached is my project.
To run:
1. Import project
2. Start mock service
3. Run Sample Project -> Sample Simple Testsuite -> Simple Login and Logout Property Expansion and search test case.
4. In Test Request: Search test step notice response have the 38c* string removed compared to the mock service response. Also notice XPath assertion pass.
Let me know if you have any additional questions.
Regards,
Marcus
SmartBear Support
As a workaround I've modified the response in a test case I setup using an event handler RequestFilter.afterRequest. Code is below, modify it to replace the test case name, namespaces, and xpath's with what you are using.
if ( context.getCurrentStep().getLabel() == "Test Request: search")
{
log.info "here we go"
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder(context.httpResponse.responseContent)
holder.namespaces["sam"] = 'http://www.soapui.org/sample/'
def price = holder.getNodeValue("//sam:searchResponse[1]/item[1]/price[1]")
def idx = price.indexOf("CON|")
def idx2 = price.indexOf(",",idx)
def valueToRemove = price.substring(idx+4,idx2)
log.info valueToRemove
price = price.replace(valueToRemove,"")
holder.setNodeValue("//sam:searchResponse[1]/item[1]/price[1]",price)
context.httpResponse.responseContent = holder.xml
}
I put this data (12649064,U|289843,D|274039,A|73611,S|34,P|2,PL)(SCIDIR,CON|38c1-4a9fdb5734147598f96-bbc86d9af2d396ab-O,SSO|REG_IP,ACCESS_TYPE) in a <price> element using a mock service and took out the 38c* data so the result is (12649064,U|289843,D|274039,A|73611,S|34,P|2,PL)(SCIDIR,CON|,SSO|REG_IP,ACCESS_TYPE) to compare against using a XPath match assertion.
Attached is my project.
To run:
1. Import project
2. Start mock service
3. Run Sample Project -> Sample Simple Testsuite -> Simple Login and Logout Property Expansion and search test case.
4. In Test Request: Search test step notice response have the 38c* string removed compared to the mock service response. Also notice XPath assertion pass.
Let me know if you have any additional questions.
Regards,
Marcus
SmartBear Support