Ask a Question

JsonPath Assertion difference between ReadyAPI and SoapUI Community

SOLVED
Flo
Contributor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Flo
Contributor

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

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 !

 

View solution in original post

7 REPLIES 7
Lucian
Community Hero

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

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 Cat Sad



If my answer helped please click on the 'Accept as Solution' button.
Radford
Super Contributor

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

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
Contributor

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

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
Super Contributor

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

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.

Flo
Contributor

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

I opened a Support Ticket for this issue : Ticket URL

It is confirmed as a bug but I don't know when it will be released. I am waiting for this

 

Radford
Super Contributor

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

If it's been confirmed as a bug by SmartBear I would ask to see if the fix can be included in the Maintenance Build. When I last upgraded Ready API I had to get multiple fixes released in the Maintenance Build, before I could successfully upgrade and run all of our test projects.

Flo
Contributor

Re: JsonPath Assertion difference between ReadyAPI and SoapUI Community

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 !

 

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: