Event to remove CDATA from response
So - the service I am testing returns its relevant data in a CDATA wrapper. I created an event to remove the CDATA wrapper so that I can assert against xml fields.
It works fine but when my tests are in a Datasource Loop, the event only runs within the loop if I send a request first.
It's annoying that I've a mass of regression tests to run but I have so send the request once before I can kick off the loop
Any ideas ?
Event is a SubmitListener.afterSubmit abd contains:
if( submit.response == null )
def responseContent = submit.response.responseContent
responseContent = responseContent.replaceAll( "<!\\[CDATA\\[", "")
responseContent = responseContent.replaceAll( "]]>", "" )
responseContent = responseContent.replace( '<?xml version="1.0" encoding="UTF-8"?>',"" )
log.info( responseContent )
submit.response.responseContent = responseContent
Can you please describe your issue in more detail? Provide us with a screenshot of your test case configuration when it works and when it doesn't work.
If I understand you correctly, the event only works if you send a request as a first step in the loop. If it is the issue, then I cannot reproduce it, please see my sample video: https://www.screencast.com/t/s1j83v4Px4
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️