Parameter variable parameter for testing REST service in Jmeter

I am testing a RESt service with a path parameter.

/my-service/v1/Customer/order/{ordernumber}

I want to increase the number by 1 for each request. How to achieve this in Jmeter? So far I have been going through a fixed path parameter, so our test result was only on one input parameter.

/my-service/v1/Customer/order/5247710017785924
+6
source share
5 answers

A good point to start is to put the original order value in a user variable

Given the initial order as "5247710017785924", you need to create the variable "ordernumber" and set its value to 5247710017785924.

, BeanShell HTTP- :

long ordernumber = Long.parseLong(vars.get("ordernumber"));
ordernumber++;
vars.put("ordernumber",String.valueOf(ordernumber));

HTTP Sampler

/my-service/v1/Customer/order/${ordernumber}
+9

JMeter Counter .

+2

, 1 . , , . , , .

CSV , :

/my-service/v1/Customer/order/5247710017785924
/my-service/v1/Customer/order/5247710017785976
/my-service/v1/Customer/order/5247710017785984
/my-service/v1/Customer/order/5247710017785991

CSHTTPle http- . , CSV HTTP- Jmeter, :

fooobar.com/questions/1483761/...

+2

.

  1. HTTP-, , /api/v2/state/find/${id}
  2. HTTP request --> Preprocessor → User Parameters ->Add variable → input id and it value
  3. HTTP-,

HTTP Request

User parameters

+2

Referring to a participant who suggests using custom parameters to add a customer or order ID to the API. This works, but if there is no way to bulk load users, it does not scale for large amounts of data. Useful if you want only a few (maybe up to ten), since all of them must be entered manually.

0
source

All Articles