How to change Post Body content in JMeter HTTP request

Please forgive my ignorance as I am jmeter noob. My web service accepts JSON objects, so I was able to write a rudimentary test where I create an HTTP request with a JSON object in the "Post Body" part of the http request.

In any case, I want the HTTP request to select a different JSON object from the csv file or another input mechanism so that I can randomize the types of requests that are executed during the load test. Is there any way to do this? The closest one is probably using variables (section 4.11 in the user manual), but I feel that not how the variables are used.

The second way that I have theorized (although I have not tried it yet, since I think the method above is simpler) is to create a default obj HTTP request with a bunch of HTTP requests with various JSON objects in them, and then use a random controller for random going through multiple HTTP requests per pass.

If there is a third way, I’m all ears to find out how to use this tool. I will continue to read and possibly experiment with plan B above. Thanks in advance for any help you can give me.


UPDATE: So, I tried the second method and it seems to work. I had 3 different HTTP requests, and the number of times each request hits varies from run to run. I still invite answers from the community, as I would like to see what professionals are doing for problems like mine.

+7
json jmeter load-testing
source share
1 answer

You partially answered your own question by saying "csv file or". Here are the features.

You will need to use the CSV data configuration in your test plan to read data from the CSV. Use variables read from CSV in your mail body.

Here is a screenshot showing how to use the csv dataset configuration.

+4
source

All Articles