UFT API - XML Compare

Issue : I am comparing two XML File through UFT API XML Compare activity. But, I am not able to parameterize the same.

Could you please help me to do the same for different-different XML file at run time how to do it ?

Scenario : I have to compare two XML file(Dynamic-run time) by ignoring element order.

Tried : By sorting XML through XSLT and then XMLUtil but still not giving exact result where order is changed this I can do with XML Compare activity UFT API. But here is the problem with I cann't change the File at run time.

Thanks in Advance!

Kundan Kumar

Tags:

Parents
  • Try this -

    1. Add two read from file activities to canvas. Parameterize the file paths to xml file path

    2. Link the output of read from file activity as input to xml compare

     

     

  • Thanks swaroopjoshi,

    I have tried the solution provided by you and it's working as expected.

    But I am still facing some issues since XML COMPARE ACTIVITY is not gving exact result

    For Eg -

    If any element is added in a particular node of 2nd XML file then XML COMPARE ACTIVITY showing changes("Element Name Changed") for some elements in subsequent nodes. If i compare only those nodes then its working fine but giving wrong reaults  when compare whole file at once.

    Please guide me. Now, using licenced version of UFT.

    Thanks!

    Kundan Kumar

  • Ok. IF UFT xml comparison is not working, you can try two other things -

    1. Write a vbscript code to compare two xmls - this requires considerable coding skills as you will need to write recursive function to parse the xmls. Go ahead and give it a try if you are up for it and have the time.

    2. There are lot of open source tools that already do xml file comparison. Just get hold of any one and invoke it from UFT. This will save your time

  • Thanks for the suggestion,

    We've already apply the 1st approach vbscript code to compare two XML through recursive function. But, the problem is with large file like around 70000 lines, performance got down and some time UFT hanged up.

    The 2nd approach - Could you please suggest us the tool which is easy to work with UFT and what would be the process. As we don't have access to freely install and do the R&D in office environment.

    We already spend much time with XML compare thorough API. Will it not possible to continue with API approach.

    Our simple requirement is to compare two XML file from two environment(So, parametrization required) with ignoring the element order facility.

    Thanks you so much in advance!

    Kundan Kumar

     

  • Thanks for the suggestion,

    We've already apply the 1st approach vbscript code to compare two XML through recursive function. But, the problem is with large file like around 70000 lines, performance got down and some time UFT hanged up.

    The 2nd approach - Could you please suggest us the tool which is easy to work with UFT and what would be the process. As we don't have access to freely install and do the R&D in office environment.

    We already spend much time with XML compare thorough API. Will it not possible to continue with API approach.

    Our simple requirement is to compare two XML file from two environment(So, parametrization required) with ignoring the element order facility.

    Thanks you so much in advance!

    Kundan Kumar

     

Reply
  • Thanks for the suggestion,

    We've already apply the 1st approach vbscript code to compare two XML through recursive function. But, the problem is with large file like around 70000 lines, performance got down and some time UFT hanged up.

    The 2nd approach - Could you please suggest us the tool which is easy to work with UFT and what would be the process. As we don't have access to freely install and do the R&D in office environment.

    We already spend much time with XML compare thorough API. Will it not possible to continue with API approach.

    Our simple requirement is to compare two XML file from two environment(So, parametrization required) with ignoring the element order facility.

    Thanks you so much in advance!

    Kundan Kumar

     

Children