1

I have to do a stress test on my application to create 1000 users. In order to create a user I do a POST request using a json:

{
 "code": "string",
 "domainName": "string",
 "enabled": true,
 "name": "string"
}

I can't figure out how I am going to create more than one user with jmeter. Is there a for loop? Also how do I get around the fact that code has to be unique so each user would need a unique code?

H.A.
  • 161
  • 1
  • 4
  • 18

3 Answers3

1
  1. To create more virtual users just define as many as you like under Thread Group

    JMeter Thread Group 1000 users

  2. To send unique data you can replace your code value with i.e. JMeter Function, something like:

            {
              "code": "${__threadNum}",
              "domainName": "string",
              "enabled": true,
              "name": "string"
            }
    

    The above example uses __threadNum() function which basically returns current virtual user number, so code will be 1 for first user, 2 for second user, etc. You can also consider the following alternatives:

    • __Random() - generates a random string within the given range
    • __RandomString() - generates a random string from given source data
    • __UUID() - generates an unique GUI structure
    • counter() - generates an incrementing number each time being called

See Apache JMeter Functions - An Introduction for more information on JMeter Functions concept.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

Yes, there is a Loop Controller and you can load data from CSV within that loop - have a look at this StackOverflow answer

Dazed
  • 1,069
  • 9
  • 34
0

Although using a loop would create your 1000 users, they would not execute at the same time. Assuming your intention is to execute a stress test with 1000 users doing requests concurrently a normal Thread Group would suffice. You can use the CSV controller (http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config) to set up the different users so each thread has its own user variables. There are other Thread group controllers that you can use if you want more elaborate behavior.

Ray Oei
  • 1,827
  • 1
  • 17
  • 21