1

I want to hit an API with different data that will be fetched from a CSV and this data will be hit one at a time after every second.

What I did is that used CSV data config to upload data and in thread group I added 30 and in ramp-up I added 30 as well so that after every 1 second an API hit is made. Is this the correct configuration?

2 Answers 2

2

If you want to limit JMeter execution rate to 1 request per second consider adding either Precise Throughput Timer

enter image description here

or Throughput Shaping Timer:

enter image description here

With regards to the number of threads - it depends on your application response time. If it is 1 second or less - 1 thread will be sufficient. If it's 2 seconds - you will need 2 threads, etc. You can also consider using Concurrency Thread Group which can be connected to the Throughput Shaping Timer via Feedback Function so JMeter will be able to kick off more threads if the current amount is not sufficient in order to run the requests at "1 request per second" rate.

1

Yes, your configuration seems to be on the right track. To hit an API with different data fetched from a CSV file and ensure that each API request is made after every second, you can follow these steps:

  1. Add a "Thread Group" to your Test Plan in JMeter.
  2. Set the number of threads (users) in the Thread Group to the desired value, such as 30 in your case.
  3. Set the ramp-up period to 30 seconds, indicating that JMeter will take 30 seconds to reach the full number of threads specified.
  4. Add an "HTTP Request" sampler to the Thread Group.
  5. Configure the HTTP Request sampler with the necessary details, such as the API endpoint, request method, headers, etc.
  6. Add a "CSV Data Set Config" element to the Thread Group.
  7. Configure the CSV Data Set Config to read the data from your CSV file. Specify the filename, variable names to hold the data, delimiter, etc.
  8. Within the HTTP Request sampler, use the variable names defined in the CSV Data Set Config to pass dynamic data to the API request.
  9. Add a "Constant Timer" element as a child of the HTTP Request sampler.
  10. Set the Constant Timer's value to 1000

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.