You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am suggesting a new feature, not asking a question
Description
I'm testing API endpoints in which the test case is that in total 10 minutes I have to ramp up users linearly until the rps is >= 70 if rps greater than 70 and the current time is < 10 minutes then maintain in steady state for remaining time. My question is, is there a way I can take the current RPS and user count in every iteration? My code is
from locust import TaskSet,HttpUser, LoadTestShape
class Scan(TaskSet):
@task
def perf_scan(self):
self.client.get(“/api”)
class url(HttpUser):
tasks = [Scan]
class CustomLoadShapeScenario2(LoadTestShape):
def tick(self):
total_time = 600
run_time = self.get_run_time()
if RPS < 70 and run_time<total_time: # here for RPS I need a solution to extract from locust
users = run_time//10
spawn_rate = 1
elif run_time<total_time:
users = user_count # here for RPS I need a solution to extract from locust. It is the user_count until the if condition was satisfied
spawn_rate = 1
return (users, spawn_rate)
Any code example or solution will be of great help.
The text was updated successfully, but these errors were encountered:
A one possibility I can see would be to access the stats instance within environment and then lookup inside it's entry dictionary and then on entry's num_reqs_per_sec property.
A one possibility I can see would be to access the stats instance within environment and then lookup inside it's entry dictionary and then on entry's num_reqs_per_sec property.
Thank you @Sawiq. Does locust supports different endpoints with different custom load shape? For example if I have 10 endpoints and each endpoints have different custom load shape. I want all the endpoints to run simultaneously.
A one possibility I can see would be to access the stats instance within environment and then lookup inside it's entry dictionary and then on entry's num_reqs_per_sec property.
see doc
Thank you @Sawiq. Does locust supports different endpoints with different custom load shape? For example if I have 10 endpoints and each endpoints have different custom load shape. I want all the endpoints to run simultaneously.
No and yes. You cant have different load shapes for different endpoints. Load shapes only control how many User instances are started and (optionally) the distribution between User types.
Prerequisites
Description
I'm testing API endpoints in which the test case is that in total 10 minutes I have to ramp up users linearly until the rps is >= 70 if rps greater than 70 and the current time is < 10 minutes then maintain in steady state for remaining time. My question is, is there a way I can take the current RPS and user count in every iteration? My code is
Any code example or solution will be of great help.
The text was updated successfully, but these errors were encountered: