how to extract JSON path and find array length using java? for my below response data. I need to validate array length should be equal to '7' in Jmeter assertion.
[
[
"Week",
"Event Count"
],
[
"3/13/17",
"1"
],
[
"3/20/17",
"1"
],
[
"3/27/17",
"1"
],
[
"4/3/17",
"1"
],
[
"4/10/17",
"1"
],
[
"4/17/17",
"1"
]
]
Add JSON Extractor as a child of the request which produces the above JSON response and configure it as follows:
week$[*]Match No: -1

This will produce the following JMeter Variables (you can validate them using Debug Sampler):
week_1=["Week","Event Count"]
week_2=["3\/13\/17","1"]
week_3=["3\/20\/17","1"]
week_4=["3\/27\/17","1"]
week_5=["4\/3\/17","1"]
week_6=["4\/10\/17","1"]
week_7=["4\/17\/17","1"]
week_matchNr=7
You are particularly interested in the latter one

Add Response Assertion as a child of the same request and configure it as follows:
week_matchNrEquals7
This way your sampler will pass if number of matches will be equal to 7 and otherwise it will fail. See How to Use JMeter Assertions in Three Easy Steps article to learn more about using assertions in JMeter tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With