Reputation: 13
I have a JMeter test plan and a part of it extracts values from a request's response. So far, I've successfully retrieved three sets of values using JSON extractor and have been able to assess the output. Now, I need to extract a specific value by comparing it to a previously fetched value, based on a condition, using a JSON extractor.
For example, I've extracted several user_guids (such as user_guid_1, user_guid_2), and I need to extract a company_id based on the user_employee_id if it matches a userid fetched earlier from another part of the response.
I attempted to use the following JSON path expression in the JSON extractor, but it didn't work:
$..[?(@.userid == '{user_guid_1}')].employeeid
Additionally, I need to use the extracted employeeid's to iterate through a foreach loop with a dynamic count of the number of employeeid's and perform a delete operation.
Is there a way to accomplish this? Thanks in advance!
Upvotes: 0
Views: 29
Reputation: 2872
We cannot help you without seeing at least partial or better full response. Take a look at How do I ask a good question? and How to create a Minimal, Reproducible Example documentation chapters
If you want to extract a company_id
based on user_employee_id
most probably you could do it using JSONPath Filter Operators
$..[?(@.employeeid == some_id)].company_id
See JMeter's JSON Path Extractor Plugin - Advanced Usage Scenarios
Upvotes: 0