JsonPatch check failing (incorrectly)

This one is kind of weird. I’m running with the latest and greatest on master.

I get a json object back with a string field in it named email.

The expected value is a valid email address that is hard coded for the check.

The memoizedPrepared value in CheckBase, however, has the expected value for email as Sun Nov 30 00:00:00 EST 2

I have no idea how the memoizedPrepared has this value. It’s in none of my checks and is no where in my response.

My guess is it’s a recent regression introduced into master, but I haven’t had time to look into it.

Any help out there?

–Spencer

The memoizedPrepared value in CheckBase also looks broken for a jsonp check I’m doing.

I’ve confirmed the response as a valid jsonp response.

It’s of the form:
{“body”: {“Hdr”:{},“Data”:{}},“status”:200}

It detects the field names body and status.

It gives the right value for status

But the key-value pair for body shows up as “Invalid evaluation expression” for the key and value when use IDEA.

No idea if that provides more help or not, or if this is the same problem or not. But it is in the same region of code.

–Spencer

Could you provide a JSON sample and what your expression look like, please?

It looks like the new JSON parser we use was trying to be too smart…

@Spencer: could you provide a JSON sample so I can make sure we can get this fixed, please?

Yeah - I was going to try to work up a dummy test with a similar data structure today. Gimme a few hours :slight_smile:

Would be great, thanks!

Here’s the json that is being returned by the service:

{
“aboutMe”:“You won’t like me if I’m on fire”,
“acceptedTerms”:“true”,
“dob”:“2000-01-01”,
“email”:“bobby.tables@example.com”,
“firstName”:“Smokey”,
“gender”:“M”,
“lastName”:“Tester”,
“phone”:“5555555550”,
“userName”:“smokey”
}

Here are the checks I’m doing:

http(“Check All Demographics”)
.get("/p/demographics")
.check(status is 200)
.check(jsonPath("$.firstName") is (“Smokey”))
.check(jsonPath("$.lastName") is (“Tester”))
.check(jsonPath("$.userName") is (“smokey”))
.check(jsonPath("$.dob") is (“2000-01-01”))
.check(jsonPath("$.gender") is (“M”))
.check(jsonPath("$.email") is (“bobby.tables@example.com”))

.check(jsonPath("$.phone") is (“5555555550”))

.check(jsonPath("$.aboutMe") is (“You won’t like me if I’m on fire”))
.check(jsonPath("$.acceptedTerms") is (“true”))

Here’s the failure from simulation.log:

UPS Test 7252415221058156663-9 REQUEST UPS Test Check All Demographics 1389701348744 1389701348744 1389701348801 1389701348801 KO jsonPath($.email).is: (bobby.tables@example.com) failed: found Sun Nov 30 00:00:00 EST 2 https://dsx-dev.weather.com/p/demographics 200 {“aboutMe”:“You won’t like me if I’m on fire”,“acceptedTerms”:“true”,“dob”:“2000-01-01”,“email”:“bobby.tables@example.com”,“firstName”:“Smokey”,“gender”:“M”,“lastName”:“Tester”,“phone”:“5555555550”,“userName”:“smokey”}

Thanks!

Expect a fix in a matter of hours (have to get in touch with Richard Hightower, Boon’s author).

OK!

I have a fix and proposed a pull request for the Boon parser.
I’ll have to wait for owner’s feedback before merging, releasing this dependency, and then push on Gatling’s master.

It will take a few hours at least, sorry.
As a workaround, you can build Boon on your own: https://github.com/RichardHightower/boon
There’s already a temporary fix in master there.

Thanks for reporting!

Thanks for the fix!

I’ll keep an eye out for the boon version update.

We’re using gatling in our CI environment, and I’d prefer not build another tool/dependency from scratch.

When 2.0.0-M4 rolls out, I probably should look at rolling over to the Jenkins plugin at that point. Right now, I’m doing some awesome bash scripting to run gatling and report D-:

We may have another problem.

I have this json object being returned:

{“zoom”:0,“result”:}

This test fails:

.check(jsonPath(“$.result[*]”).count.saveAs(“wxcheckinCount”))

The error reported:

jsonPath($.result[*]).exists: found nothing

I’m okay with their being nothing in the array - I just want the count to be 0.

I’ve got a slew of tests to write for a surprise deadline, so I can’t spend time debugging this right now. If you have anything specific you’d like me to check and report back, let me know.

–Spencer

Well, half the extactors were returning None, and the other half Some(0). I made Some(0) the standard behavior but this might be stupid… Will change the other way later tonight.

One more thing … (feeling self-conscious now)

It looks like a lot of my jsonpJsonPath checks are failing.

I have a response that looks like:
angular.callback._1({“status”:200, body:[{},{}]})

The check is:
.check(jsonpJsonPath("$.status").is(“200”))

The message is:

jsonPath($.status).is: (200) failed: found nothing

I’ve fixed the parser issue (weird date), change the count behavior so that it returns Some(0) instead of None.
jsonpJsonPath seems to be working fine, maybe it was also fixed.

Well, it looks like all of my jsonPath checks are passing now.

However, all of my jsonpJsonPath tests are still failing.

Attached is a screenshot from IDEA of the memoizedPrepared structure in memory.

You can see in the screenshot that in the response, body has children. However, IDEA is reporting “Invalid evaluation expression”. I’m not sure what’s up with that - if that’s the problem or just an IDEA-ism.

the body field has a sibling field, status, which has a value of 200

{“body”:{“ZFHdr”: { … more fields … }, “ZFData”: { … more fields … }}, “status”: 200}

Actually, I think the data structure is fine - just not understood by IDEA.

The extractor, though, clearly isn’t working.

No idea why not. My query is:
jsonpJsonPath("$.body.ZFHdr").count.not(0)

You can see in the screenshot attached in my last email that ZFHdr is there.

But the extractor says 0 are found.

:confused:

Yep, “Invalid evaluation expression” is something from IntelliJ’s scala plugin.

Will check this jsonp stuff again later today. Thanks for your patience.

Currently investigating.
Just one question: what’s your JDK version?

Pretty sure it’s 1.7, but I’m away from my machine to be sure.

No pro, I’ve just found the problem. Will fix in a matter of minutes.