2

I have an http response with JSON array

 {"message":"SUCCESS","possibilities":
[{"type":"title","value":"Mercedes-Benz FashionWeek New York"},
{"type":"title","value":"Mercedes-Benz FashionWeek New York"},
{"type":"title","value":"Mercedes-Benz FashionWeek New York"},
{"type":"title","value":"Chicago Fire vs. New York City"},  
{"type":"title","value":"New York Mets vs. Philadelphia Phillies"},  
{"type":"title","value":"New York Knicks vs. Detroit Pistons"},  
{"type":"title","value":"Baltimore Orioles vs. New York Yankees"},  
{"type":"title","value":"New York Mets vs. Philadelphia Phillies"},  
{"type":"title","value":"Tampa Bay Rays vs. New York Yankees"},  
{"type":"title","value":"Tampa Bay Rays vs. New York Yankees"},]}

I need to verify there are no duplicates titles (in my example, the first 3 results are duplicates).

What is the best way to do it in Jmeter?

  • If it makes it easier, the 10th result can't be the same as the first one for example, so it's possible to compare between a title to the previous one (for example, if the 3rd title is equal to the 2nd one)

1 Answer 1

1

Step 1. Use the JSONPath Extractor to capture all the values as an array. The JsonPath expression you would use is $..value This will return an array of values.

Step 2. Use a beanshell post-processor to iterate through the array and check for duplicates. Since you've said the list is effectively already sorted, you only have to perform n-1 comparisons for n values.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.