locust

Locust Multiple Hosts With Different Peak Concurrency (Web UI)

Locust Multiple Hosts With Different Peak Concurrency (Web UI) Question: I am trying out the Locust load testing Framework. I have a case where I want to test multiple hosts: from locust import HttpUser, task, between from tasks import TaskList class FirstUser(HttpUser): wait_time = between(5, 15) host = "https://example.com" tasks = TaskList class SecondUser(HttpUser): wait_time …

Total answers: 1

Locust – AttributeError when accessing locust web interface

Locust – AttributeError when accessing locust web interface Question: I’m trying to run a very basic locust load testing which did work previously. from locust import HttpUser, between, task class QuickstartUser(HttpUser): wait_time = between(1, 5) @task def get_status(self): self.client.get("/status/") Running the following command: locust -f <package-name>/tests/load_tests.py -r 20 -u 400 -H http://localhost:8000 yields the following …

Total answers: 1

Unable to perform RMQ publish from Locust "BlockingIOError: [WinError 10035]"

Unable to perform RMQ publish from Locust "BlockingIOError: [WinError 10035]" Question: My project requires client sending messages directly to Rabbit MQ and we need to do load testing for this. I tried PIKA, works fine in a plain python file but as soon as I tried to implement this in Locust I start getting error …

Total answers: 3

Locust – How to pass new configuration through code to locust

Locust – How to pass new configuration through code to locust Question: I am trying to run locust as a library from python code and along with that I wanted to use locust-plugins library. The main problem I am facing is that I am not able to find how to pass additional command line arguments …

Total answers: 1

Using variables from earlier in a sequential list of tasks

Using variables from earlier in a sequential list of tasks Question: Let’s say I need to first create a company, then create a bunch of employees for that company. I could do this: from locust import HttpUser, task class CompanyAPI(HttpUser): @task def create_company(self): resp = self.client.post( "/companies", json={"name": "Company Name"} ) company_id = resp.json()["id"] for …

Total answers: 2

ModuleNotFoundError : No module named with locust

ModuleNotFoundError : No module named with locust Question: When I try to import external library of my project in my locust python file, each time I have the error "ModuleNotFoundError : No module name ‘…’. Apparently is not clear but locust is installed and works. I have a task to make REST API call and …

Total answers: 2

Executing the auth token once per run – Locust

Executing the auth token once per run – Locust Question: Ideally I want to grab the token one time (1 request) and then pass that token into the other 2 requests as they execute. When I run this code through Locust though… from locust import HttpUser, constant, task import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) class ProcessRequests(HttpUser): host = …

Total answers: 1

Passing token to Locust request

Passing token to Locust request Question: I am trying to pass the Oauth token generated into a @task request This is resulting in a 401 error from locust import HttpUser, constant, task import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) class ProcessRequests(HttpUser): def on_start(self): tenant_id = "tenant123" client_id = "client123" secret = "secret123" scope = "api://123/.default" body ="grant_type=client_credentials&client_id=" + client_id …

Total answers: 1

Locust with Python: No Locust Stats are showing on UI

Locust with Python: No Locust Stats are showing on UI Question: I am new to Locust (and Python) and am trying to load test an API. My Locust UI shows no stats whatsoever – no users hatched, no API calls, etc. I need help figuring out how to get them to show up on the …

Total answers: 1

Can't run locust in debug mode

Can't run locust in debug mode Question: Recently I switched from old locust version (0.14.2) to 1.3.1. Previously I was able to run in debug mode with command WebsiteUser().run() and it stops on all breakpoints. When I try to run new version with the same command I get next error: File "/home/user/PycharmProjects/my_test/venv/lib/python3.7/site-packages/locust/user/users.py", line 210, in …

Total answers: 2