Forum Discussion

rameshsoapui's avatar
rameshsoapui
Contributor
10 years ago

Assertion related to file comparison

Assertion related to xml file comparison

I want to compare the response of service to a external file located in file system ( project directory ) .. Is it possible, if so how should I do...

With in the response, I want ignore some of the elements/values to compare from file...

Is there build in assertion ?

Please advise...

14 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    As divman said, it requires some programming to compare two xml files and no short cut for that.
    You may use api's of XmlUnit or DeepEquals (https://code.google.com/p/deep-equals/) for the same.
    Note that if there is repeating complex element, these API's expect sorted xmls as input.
  • Is this right link ?

    When I created data source as XML, could not point the xml file ? am I missing some thing here ?
  • Yes it is possible, but that requires some Groovy scripting. Could you please explain a example scenario?
  • I have a XML file on my local directory.... What ever I get from service response... I want to compare with my local xml file... this is my basic need.
    • nmrao's avatar
      nmrao
      Champion Level 3
      @divman, thank you for sharing the link. As it was mentioned in the previous post, xmlunit was pointed with additional information that if there are complex list, then xmlunit does not handle unless one can input sorted xmls to it.
      • divman's avatar
        divman
        Contributor

        Hi Rao,

         

        Thanks for your reply. Could you please help me understand here, what do you mean "input sorted xmls"?. Sorry if this is a basic question.