You can download this code by clicking the button below.
This code is now available for download.
This function generates a list of Locust User instances with a specified number of users. These instances are created based on the provided Locust User class.
Technology Stack : Locust
Code Type : Function
Code Difficulty : Intermediate
def random_user_locust(locust_user_class, user_count):
"""
Generates a list of Locust User instances with random user count.
Args:
locust_user_class (type): The Locust User class to instantiate.
user_count (int): The number of users to create.
Returns:
list: A list of Locust User instances.
"""
users = []
for _ in range(user_count):
user = locust_user_class()
users.append(user)
return users