Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to let jMeter http request sampler generate parameters?

Tags:

Is there a way to generate random parameter values in jMeter http request sampler or any other sampler?

like image 667
Rasalom Avatar asked Jan 16 '13 11:01

Rasalom


People also ask

How do I create a HTTP request in JMeter?

Create a Test Plan First For JMeter Post Requests Just right click on Test Plan and then click on the element by following this path: Threads (Users) -> Thread Group. Your Thread Group should be added now. And you can keep values in Thread Properties as they are.

What is the path in HTTP request in JMeter?

Use HTTP request defaults. This config element is used when all requests in the JMeter script are sent to the same server. This way, when you create a new HTTP request you only need to specify the method, path you want to reach and parameters if it's needed. Add an HTTP Cookie manager to the root of the test plan.


2 Answers

In JMeter, you can use counters to generate parameter values. Add your counter to the top of your test plan and choose initial, increment and maximum values. It will start counting automatically.

counter is in Pre Processors menu. You can use the counter values in HTTP samplers by using reference name. i.e. let's say your reference name is ref_counter then you can call its values in HTTP samplers with ${ref_counter}.

like image 80
Kerim Karaca Avatar answered Sep 29 '22 18:09

Kerim Karaca


You can try to use some of jmeter's functions to generate random value:

  • __Random to generate random int: ${__Random(MIN, MAX};
  • __RandomString to generate random string: ${__RandomString(LENGTH)};

as well as Random Variable config element for the same purpose.

like image 27
Aliaksandr Belik Avatar answered Sep 29 '22 19:09

Aliaksandr Belik