python locust config file for multiple filesclasses - Stack Overflow

admin2025-04-26  2

I'm using locust to do some load testing on our backend service and I have three classes defined in three different .py files

then I'm trying to run locust using this command line

==> locust -f locustfiles/locustfile.py --headless --config ../loadTestConfig.yml

locustfile.py

from myClass1 import MyClass1 
from myClass2 import MyClass2 
from myClass3 import MyClass3 

loadTestConfig.yml

    user_classes:
      - class: MyClass1
        users: 8
        spawn_rate: 8
      - class: MyClass2
        users: 2
        spawn_rate: 2
      - class: MyClass3
        users: 36
        spawn_rate: 36
    
    run_time: 2m
    host: "https://myhost"

this would give me the error when lunched that it's not recongizing the option class from the yml file.

TestConfig.yml
locust: error: ambiguous option: --=class: MyClass3 could match --locustfile, --config, --help, --version, --worker, --master, --master-host, --master-port

How could I specify per class (file) the number of user and spwan rate?? Trying to buld my load scenario.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745675257a313554.html

最新回复(0)