Forum Discussion

Bharadwaj's avatar
Bharadwaj
Contributor
7 years ago

ReadyAPI response appending zeroes after decimal and also printing fields values as hexadecimal

Hi I am running a Rest API in both ReadyAPI (pro version of SoapUI) and also in postman. The response pattern in json in postman valid while in ReadyAPI for some fields zeroes are appended after decimal value even for a integer type field like for example 

"PackSize": 60 (this is in postman which is right)

"PackSize" : 60.0000000000000000 (this is in ReadyAPI response which is incorrect)

 

Also for some fields values are returned as hex decimal pattern for example 

"PrivateTax" : 0E-16 (this is in ReadyAPI which is incorrect)

"PrivateTax": 0(this is in postman which is right)

 

I have attached json files of the responses in both postman and ReadyAPI for your reference. Am I missing any setting in ReadyAPI which is causing this issue

The version of ReadyAPI I am using is ReadyAPI 2.3.0

Build Date: 2018-03-06T16:28:42Z(433)

 

cheers,

Bharadwaj

12 Replies

  • ckramer1's avatar
    ckramer1
    New Contributor

    I am experiencing the same issue after installing 2.3 last week.  I am using a simple built in assertion on the response, comparing to the expected result stored in SQL DB. I have both 2.2 and 2.3 installed so can easily run the same test in both to see the different assertion result; success in 2.2 and failure in 2.3.  I have opened a support case.  But has anyone already successfully resolved this?  

  • Lucian's avatar
    Lucian
    Community Hero

    It works just fine for me.

     

     

    But how do you get your response? Where do you look for it? Is it in a groovy script? Is it in the JSON response tab? And what kind of request are you making? Is it a POST HTTP Request? Could you give more details? I am curious about this.

    • Bharadwaj's avatar
      Bharadwaj
      Contributor
      Hi Lucian
      Its a Rest API Call which does a http Get and I am looking the response in the JSON response tab as well as in groovy script and its the same at both places.
      Cheers
      Bharadwaj
  • Lucian's avatar
    Lucian
    Community Hero

    Maybe it's a bug? It works fine for me. I don't see why there would be a property to convert your JSON response to hexadecimal. 

    • Bharadwaj's avatar
      Bharadwaj
      Contributor
      Hi,
      I haven't used any properties its a simple RestAPI get call. If you notice the outcome of both postman and ReadyAPI(2 attached files) you will notice the difference in output. I am not sure why this should happen. In your comment you mentioned you got the same output. Sorry I couldnot understand how you executed the rest API endpoint.
      • Lucian's avatar
        Lucian
        Community Hero

        I created a mock service with the JSON you posted. This is how I could test it. Maybe just ask for smart bear support?

  • Hi,

    I am attaching the screenshots of API called in Postman and ReadyAPI. they both are exactly the same API's with same input parameters,exactly same environments and no extra logic has been applied in either of them. Has anyone had this kind of experience before or am I missing any setup in ReadyAPI which is causing this. Can someone please share some knowledge.

     

    cheers,

    Bharadwaj.

    • groovyguy's avatar
      groovyguy
      Champion Level 1

      I am not sure if there's a setting that directly controls this, but I've seen similar issues where ReadyAPI will pretty-print or format a response. If you inspect the RAW of the response, is it still the same?

  • nmrao's avatar
    nmrao
    Champion Level 3
    Couple of things :
    1. Do you see this issue with latest version only? Was it working find in earlier version?

    2. Try to submit a case with SmartBear Customer care to address it quick

    https://support.smartbear.com

    3. If you are getting issue while comparing (in assertions) because of the above? If so, then you can parse both the values (actual and expected ) to specific data type before compare.
  • Hi Guys,

    My apologies,I was offline for some time now as I have moved to a different organisation now and have no access to my previous work email which I have used to log a support ticket to this issue. Also I have encountered this issue when I have upgraded the version of ReadyAPI to the latest one and don't remember getting this issue on the older version of it. Also I have not tried ,if this issue actually reflects and affects in assertions. As I cannot access the previously used environment anymore ,I wont be able to answer much of the questions related to this topic and my apologies for that.

  • Hi ,

    My apologies,I was offline for some time now as I have moved to a different organisation now and have no access to my previous work email which I have used to log a support ticket to this issue. Also I have encountered this issue when I have upgraded the version of ReadyAPI to the latest one and don't remember getting this issue on the older version of it. Also I have not tried ,if this issue actually reflects and affects in assertions. As I cannot access the previously used environment anymore ,I wont be able to answer much of the questions related to this topic and my apologies for that.

  • ckramer1's avatar
    ckramer1
    New Contributor

    I received the below response from SmartBear support. It may help if you are comparing a single field.  We compare the complete JSON so it does not help me.

     

    "We had a bug regarding the JSON decimal in the earlier version which was fixed in 2.3. After the bug fix, the decimal type, which looks like 150.000(for example), is not truncated and the complete value is displayed.

     

    You can use Script assertion to validate decimal type now (Please see attached - bigDecimalValue.jpg). There is an example:

     

    def response = context.expand( '${REST Request#Response#$[\'decimal\']}' ) // replace the JSONPath expression with the correct one assert 150.0 == new BigDecimal(response)."