-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does locust support ‘CSV Data Set Config‘ feature like jmeter #79
Comments
Hi! Locust tests are essentially just python code so you just need to write code that reads your CSV file. For example, you could put this code at the module level in your load testing scripts. Here's a small pseudo code example: # locustfile.py
import random
from locust import Locust, TaskSet, task
# load user credentials from CSV
user_credentials = read_user_credentials_from_csv()
class MyTasks(TaskSet):
def on_start(self):
credentials = random.choice(user_credentials)
self.client.post("/login/", {"username":credentials[0], "password":credentials[1]})
@task
def some_task(self):
...
class MyLocust(Locust):
task_set = MyTasks |
thank you very much, I will try it |
Just in case anyone stumbles upon this, there is a longer blog post on this topic at https://www.blazemeter.com/blog/how-to-run-locust-with-different-users/ |
user_credentials = read_user_credentials_from_csv() can you please provide code for "read_user_credentials_from_csv()" function too. |
I am newcomer from Jmeter background, I want to get some help.
just like the example in [Quick start] section in doc of locust,
how could I share the thousands of pairs of userid and password between all threads like jmeter do?
Does locust support ‘CSV Data Set Config‘ feature like jmeter?
The text was updated successfully, but these errors were encountered: