Forum Discussion

divya_26's avatar
divya_26
Occasional Contributor
5 years ago

How to compare only selected nodes xml data of jdbc response with my json response

Hi guys,

 

I am new in automation and soap ui open source. 

In one test step, I am getting json response. 

and in another test step, I am getting xml response.(by using jdbc sql)

Now, I want to compare some of the values of my json response with that of xml response.

How should I do it.

 

lets say, my json response contains id, roll no., name, password, address.

and in xml(response from running query), i have  reg_no, name

Now i want to match roll no and reg_no.

Please suggest me how to do it. If can be done through groovy script, then please how?

 

Thanks in advance

  • nmrao's avatar
    nmrao
    Champion Level 3
    It appears that you are looking for comparing specific data. So without it (the sample data) it would be difficult imagine and suggest.
    • divya_26's avatar
      divya_26
      Occasional Contributor

      nmrao sir, here is the sample data:--

      response from jdbc :-----<Results><ResultSet fetchSize="0"><Row rowNumber="1"><CAT.ID>2</CAT.ID><CAT.ROLL_NO>100</CAT.ROLL_NO><CAT.NAME>Enid</CAT.NAME><CAT.PASSWORD>12345</CAT.PASSWORD><CAT.STATUS>1</CAT.STATUS></Row><Row rowNumber="2"><CAT.ID>9</CAT.ID><CAT.ROLL_NO>101</CAT.ROLL_NO><CAT.NAME>Alisha</CAT.NAME><CAT.PASSWORD>67891</CAT.PASSWORD><CAT.STATUS>1</CAT.STATUS></Row><Row rowNumber="3"><CAT.ID>15</CAT.ID><CAT.ROLL_NO>102</CAT.ROLL_NO><CAT.NAME>Dave</CAT.NAME><CAT.PASSWORD>45637</CAT.PASSWORD><CAT.STATUS>1</CAT.STATUS></Row></ResultSet></Results>

       

      and json response of a web service is:--

      {
      "customer": [
      {
      "last_name": "jayswal",
      "roll_num": "100",
      "password": "85658",
      "first_name": "Enid",
      "email": "dk@gmail.com"
      },
      {
      "last_name": "jayswal",
      "photo": "105",
      "roll_num": "85658",
      "first_name": "shalin",
      "email": "dk@gmail.com"

      }
      ]
      }

       

      Now i want to compare  roll no. =100 is equal to any roll no. from the json response

       

      Also, i am very new in automation. So, please enlighten me in detail regarding this query i posted. I shall be grateful to you.

      Thanks.