0

I am testing the behavior and performance of an endpoint and I have a JSON to test it, so I am sending via HTTP POST that JSON with Apache JMeter.

When sending a single request there is no problem (because it is one) but I need to do a load test more intense (for example 50 request per second) to test the performance of said endpoint with higher load. Will it be possible to iterate for example those 50 times by the same JSON and replace the value of a node of this by a different number each time before sending each request and thus be able to send the same JSON in each request but with a different value in said node?

I have seen that JMeter has a functionality called Preprocessor (preprocessor) but I don't know how it is implemented. This is the body of the JSON and the specific node to which you could assign a different value for each request. I think it is important to mention that there are other nodes with the same name (id) in the rest of the JSON body but I need to modify only the one that I mention.

enter image description here

0

There is inbuilt function in Jmeter which it will generate a random number.

Using ${__Random(0,10)} will generate number from 1 to 10

In your request you want to generate random six digit number then you can use function as ${__Random(0,100000)}

How to use this in your request payload?

Consider your actual request payload is as shown below

{
  "id":123,
  "name": "QAtester"
}

If you want to generate random number for property id then we can use our Jmeter function ${__Random(0,100000)} in the request payload

{
  "id":${__Random(0,100000)},
  "name": "QAtester"
}

This will generate random number for each request

Reference: https://jmeter.apache.org/usermanual/functions.html#__Random

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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