Forum Discussion

vpachpute1's avatar
vpachpute1
Frequent Contributor
9 years ago

To compare 2 xml responses

Hi I wanted o compare 2 xml responses.

 

I have used following groovy script. But it shows Assertion error. can you please help me out.

 

If there any other solution except Groovy script, please suggest. I am using readyAPi version 2.0

 

In my scenario, I have to check subscriptions data before modify MSISDN and after modify MSISDN. I compared bot responses using Meld comparison tool. Both are same. But using following groovy scrip, it shows assertion error.

 

*************

import groovy.xml.XmlUtil
import org.custommonkey.xmlunit.*

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def xmlParser = new XmlParser()

def response1, response, holder, holder1, xml, xml1

holder1 = groovyUtils.getXmlHolder("SelfFullSubs - Before modify MSISDN#Response")
response1 = holder1.getXml()
xml1 = xmlParser.parseText(response1)

holder = groovyUtils.getXmlHolder("SelfFullSubs - After modify MSISDN#Response")
response = holder.getXml()
xml = xmlParser.parseText(response)

assert xml == xml1

*************

 

Regards

Vishal