(RequestFilter.afterRequest) triggered when (SOAP Request) is sent but not when Project Test is Run?
I am very new to SoapUI and I may be missing something very obvious so please go easy on me!
I have set up a project with a Test Case that contains a Soap Request.
I am using an event handler to remove some "CDATA" code, so that the resulting formatted xml will be easier to extract values from.
The event handler triggers fine when I run the request in the request editor (click the "Send" button), i.e. the properly formatted XML is displayed in the response field.
But, if I click the "Run" button, all the test steps are executed but the event handler does not trigger and it does not remove the problematic "CDATA" text.
I have some property transfers that are set up to extract the data when the properly formatted XML response is returned, but these are not found when all the test steps are Run.
Here is my code for the Event Handler:
// Get the response content if( request.response == null ) return def content = context.response //httpResponse.responseContent // Replace the string content = content.replaceAll( "<!", "") content = content.replaceAll( "\\[CDATA\\[", "" ) content = content.replaceAll( "<\\?xml version=\"1.0\" \\?>", "" ) content = content.replaceAll( "]]>", "" ) // Write the new content to the response context.httpResponse.responseContent = content
Any help on this would be greatly appreciated.
Solved! Go to Solution.
Probably, you want to quickly try
Hope you might aware of documentation
Thanks for your help,
I transferred the Groovy code to the TestRunListener.afterStep and it works now when running the full test.