Forum Discussion

Flo's avatar
Flo
Contributor
6 years ago

JsonPath Assertion difference between ReadyAPI and SoapUI Community

Context : I develop my test using ReadyAPI/SoapUI Pro from my own computer. I launch tests in continuous integration process from Jenkins using testrunner.sh from free SoapUI.

 

ReadyAPI 2.4.0 (same result when testing with version 2.5.0) - SoapUI Community 5.4.0

 

Issue: One JsonPath assertion is OK with SoapUI Pro but not with Community version

 

Given this Json Response

{
 "a": [
{ "b":["name"] }
] }

I want to assert the value of field "b". I use JsonPath "$.a[0].b" and get expected result with "Select from current" button.

With SoapUI Pro I got this : name

With SoapUI Community I got this : ["name"]

 

It feel like SoapUI Community result is the good one, but I am stuck between local test development using Pro version and Jenkins test running using community version.

 

Does anyone have the same issue ? Do you have any workaround, tips to figure out a solution ?

 

PS: I was not able to give a full project example from my data. I didn't find community project to explain and reproduce my case. Feel free to give me project to try.

  • Flo's avatar
    Flo
    6 years ago

    You said it is a bug, but here is an extract of the documentation from json-match Documentation page

     

    Expression containing filters ([?(filter)] and array slices ([start:end] always returns arrays, even if the resulting array contains a single item.

     

    So, it seems like a featured-bug or so one !

     

7 Replies

  • Radford's avatar
    Radford
    Super Contributor

    The JSONPath library that Ready API uses was updated in version 2.3, The JSONPath Reference documentation page talks about differences in the returned data before and after this version (see the end of the section headed "Usage Notes and Considerations").

     

    I'm not a JSON expert so do not know if this applies to you or not, but worth a read I think. If SoapUI Community 5.4.0 was using the older version of this library, this could explain the difference?

     

    I know this is not an answer, but hope it helps.

     

    I you think it is a bug I would log a support case at:

     

    https://smartbear.secure.force.com/support/WebToCase?showHeader=0&product=ReadyAPI

    • Flo's avatar
      Flo
      Contributor

      This is a very nice point !

      I checked : SoapUI Community is using JsonPath 0.9.1.

      I tried to use json-path-2.4.0-fixed.jar for SoapUI Community, addind related dependencies but I am facing NoClassDefFoundError. I guess there are bad dependencies using 2.4.0 version.

      • Radford's avatar
        Radford
        Super Contributor

        So looking at the versions of the JayWay JSONPath library ReadyAPI uses in its various different versions (from the JSONPath Reference doc page linked above):

         

        • ReadyAPI 2.3 and later – JayWay JSONPath 2.4.0
        • ReadyAPI 1.4.1 – 2.2 – JayWay JSONPath 2.0.0
        • ReadyAPI 1.1 – 1.4.0 – JayWay JSONPath 0.9.1

        You have to go all the way back to ReadyAPI 1.4 to match the JSONPath library version in the comunity edition.

         

        Sorry, I don't think I'm going to be able to help further. Please do update here if you find a solution.

  • Lucian's avatar
    Lucian
    Community Hero

    It looks like ReadyApi identifies name as the only element in the list and automatically converts it to a primitive value. This looks like a bug :catsad: