0

I am trying out Locust. Here you are able to swarm your system with simulated number of users within a specified hatch rate.

class UserBehavior(TaskSet):  
    def on_start(self):  
        self.login()  

    def login(self):
    payload = {"grant_type": "password",
              "username": self.my_user,
              "password": self.my_pw,
              ...
              }
            }
    headers = {'content-type': 'application/json'}
    response = self.client.post("/rest/v10/oauth2/token", data=json.dumps(payload), headers=headers, catch_response=True)
    self.token = response.json()['access_token']

    @task(1)
    def fetch_accounts(self):
        headers = {'oauth-token': self.token}
        response = self.client.get("/rest/v10/Accounts", headers=headers)   

What is the implication of using:

  1. A single self.my_user and self.my_pw with Number of users to simulate: 5

  2. 5 different self.my_user and self.my_pw with Number of users to simulate: 1

  3. 5 different self.my_user and self.my_pw with Number of users to simulate: 5

Which of the three provides a more reliable output for a load testing report?

Dee
  • 401
  • 3
  • 9
  • 22

1 Answers1

1

Short answer

It depends on the behavior of your application under load.

Long answer

Generally, you want the simulated load to match the real load as closely as possible. In real load, it's not very likely that all the users would use the same username/password, nor that a single user would use many username/passwords. So I would say that your option 3 is probably the most realistic. But again, it depends on your application. If it turns out that your application behaves the same regardless of the number of distinct username/password combinations, then it might not matter at all.

Flight Odyssey
  • 2,267
  • 18
  • 25