Assertion falsely failed on JSON return

246 views
Skip to first unread message

zuzik...@gmail.com

unread,
Feb 2, 2017, 5:30:59 PM2/2/17
to jmeter-plugins
Hi Andrey,

this issue started here:

I have the latest JMeter/Json plugin

I was fighting these false failures with assertions for a quiet some time.
What I found is that if I remove the parenthesis from the strings - the assertion passes just fine. 

For instance, in this string: 

Assertion failure message: Value expected to be '33190 Christopher Camp, Apt. 820, NJ, New Jesusview, Bouvet Island (Bouvetoya), 64162-1026', but found '33190 Christopher Camp, Apt. 820, NJ, New Jesusview, Bouvet Island (Bouvetoya), 64162-1026'
I removed just parenthesis and have no problem with assertion since the last October.

Today I got these:

Assertion failure message: Value expected to be 'Serial number (23323) does not belong to Customer (001)', but found 'Serial number (23323) does not belong to Customer (001)'
These strings are identical. And if I remove parentheses from the messages - assertion never fails.

Hope it helps you to get the root-casue.

Thank you,
Andrey

Andrey Pokhilko

unread,
Feb 3, 2017, 2:54:17 AM2/3/17
to jmeter-...@googlegroups.com

Hi,

Can you please provide an example for me to reproduce it? I'll need all assertion settings and sample JSON.

Andrey Pokhilko

--
You received this message because you are subscribed to the Google Groups "jmeter-plugins" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jmeter-plugin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

zuzik...@gmail.com

unread,
Feb 3, 2017, 12:21:33 PM2/3/17
to jmeter-plugins
Sure,

this is how I do it in the taurus:

        assert-jsonpath:
       
- jsonpath: "$.error"
          validate
: true
          expected
-value: "Serial number (${serial}) does not belong to Customer (${customer})"
       
- jsonpath: "$.status"
          validate
: true
          expected
-value: 400

This is the Json response:

{"error":"Serial number (23323) does not belong to Customer (001)","status":400}

The values are:

serial = 23323
customer
= 001


Thank you,
Andrey

error":"Serial number (23323) does not belong to Customer (001)","status":400}

Andrey Pokhilko

unread,
Feb 3, 2017, 1:27:12 PM2/3/17
to jmeter-...@googlegroups.com

There were a bug fixed in JSON plugin around this recently. Can you make sure you have the latest plugin installed?

Andrey Pokhilko

zuzik...@gmail.com

unread,
Feb 3, 2017, 4:41:34 PM2/3/17
to jmeter-plugins
I wiped out the whole jmeter and the Taurus re-installed it.
Have 2.6 version in the ext folder: jmeter-plugins-json-2.6.jar

The results is the same - false failure

Andrey Pokhilko

unread,
Feb 4, 2017, 2:15:06 AM2/4/17
to jmeter-...@googlegroups.com

You have sent me the assertion settings, but did not send actual JSON you get from server. I need it to reproduce the issue.

Andrey Pokhilko

Zuzikovitch

unread,
Feb 4, 2017, 10:12:46 AM2/4/17
to jmeter-...@googlegroups.com
Actually I did send it :)

Right below the assertion. Copying here:

This is the Json response:

{"error":"Serial number (23323) does not belong to Customer (001)","status":400}

You received this message because you are subscribed to a topic in the Google Groups "jmeter-plugins" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jmeter-plugins/-wTW5EKUFLs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jmeter-plugin...@googlegroups.com.

Andrey Pokhilko

unread,
Feb 4, 2017, 10:37:48 AM2/4/17
to jmeter-...@googlegroups.com

This looks like Taurus issue. JMeter plugin enables matching as regexp by default, so your string template does not match.

Temporary workaround would be to modify your template with backslashes: expected-value: "Serial number \(${serial}\) does not belong to Customer \ (${customer}\)" . Maybe you'll need double backslashes, I'm not sure.

The proper solution would be to support the regexp flag in Taurus.


Andrey Pokhilko

Reply all
Reply to author
Forward
0 new messages