web services - Groovy and XMLUnit: compare webservice results -
using groovy , xmlunit trying write script compare xml output of web services multiple endpoints. attempting working 1 endpoint iterate on endpoints compare output, however, continue following error:
caught: groovy.lang.groovyruntimeexception: not find matching constructor for: org.custommonkey.xmlunit.diff(groovy.util.node, groovy.util.node) groovy.lang.groovyruntimeexception: not find matching constructor for: org.custommonkey.xmlunit.diff(groovy.util.node, groovy.util.node) i pretty sure has inexperience both xmlparser/xmlslurper , xmlunit (a.k.a. newbie). appreciate pointers in right direction. here sample code causes exception:
@grab(group='xmlunit', module='xmlunit', version='1.5') import org.custommonkey.xmlunit.* def url = "http://www.webservicex.net//geoipservice.asmx/getgeoip?ipaddress=173.201.44.188" def xmlparserresults = new xmlparser().parse("$url") //same thing happens if use... //def xmlslurperresults = new xmlslurper().parse("$url") def xmldiff = new diff(xmlparserresults, xmlparserresults) assert xmldiff.identical() thank in advance!
the url returns xml , diff takes 2 strings compare (in case comparing nodes). easiest way compare use url instead of trying parse using xmlparser or xmlslurper.
def url = "http://www.webservicex.net//geoipservice.asmx/getgeoip?ipaddress=173.201.44.188" def xmlstring = new url(url).text def xmldiff = new diff(xmlstring, xmlstring) assert xmldiff.identical() in case above sample , not working example of hitting multiple endpoints point represent xml output string , compare.
Comments
Post a Comment