-
Hello! ContextI am working on a package that contains abstract reusable user classes with common functionality in a few APIs that I would like to load test instead of rewriting the same user class in each one of those APIs since they're all in different repositories. Some user classes require custom parameters which I have defined by adding a listener and invoking the @events.init_command_line_parser.add_listener
def custom_arguments(parser):
parser.add_argument(
"--name",
type=str,
default=""
)
class SampleReusableUser(FastHttpUser):
abstract = True
...
other functions implemented here
ProblemSome users require custom params, some uses dont. The problem arises when I import anything from my package, the custom params do show up on the UI even if the user I am importing does not define an event listener. I assume that is because there is no logic to control for adding the event listener described above so locust correctly adds those arguments. My question is:
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think the easiest way to accomplish this is by using multiple locustfiles. Then you can do something like
or
if you want to prevent a method from being called, I’d recommend env vars, something like
|
Beta Was this translation helpful? Give feedback.
-
Thank you @cyberw Ill try to restructure it that way 🙏 |
Beta Was this translation helpful? Give feedback.
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