'I have been trying to add a dynamic value in the url path of an api in Jmeter script from response code of other api. Help me out

I have an api which has many folder to it and each folder have more than two contents and I want to compare each contentid in folder from response code with other duplicate api response code which has same contents as this api in Jmeter

For eg. The folders are in a path something like https://apple.test.com/user/folder(just an example url)

To extract each folder I have used json extractor for above url in http request and extracted the folder id (with json path as $..folderid...if I select ALL in the extractor and try to use ${folderid_ALL} in url path I am getting an error), then created another http request and passed this variable in the url something like

https://apple.test.com/user/folder/${folderid}

And used beanshell assertion to compare their contentid

When I execute this only the first folder is picking up and it's contents are compared and rest of the folders are not shown

Can you help me out on how to extract all the files and compare their contents!!



Solution 1:[1]

If you have multiple folder IDs extracted into JMeter Variables using JSON Extractor you can use ForEach Controller to iterate all the IDs.

Also since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting so consider migrating to the JSR223 Assertion

In order to get the comprehensive answer you should include:

  1. The JMeter Variables generated by the JSON Extractor
  2. The format of the "next" request for the "folder"
  3. The response you're getting
  4. What do you want to compare with what

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T