Skip to content

Handling Custom Parameters for a Reusable User Class #3028

Answered by cyberw
oielbanna asked this question in Q&A
Discussion options

You must be logged in to vote

I think the easiest way to accomplish this is by using multiple locustfiles. Then you can do something like

locust -f add_name_parameter.py,users_that_use_name.py

or

locust -f users_that_dont_use_name.py

if you want to prevent a method from being called, I’d recommend env vars, something like

if os.getenv(”USENAME”):
    @events.init_command_line_parser.add_listener
    def custom_arguments(parser):
        …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by oielbanna
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants