Search code examples
pythonperformance-testinglocust

how to generate locust html file without UI?


how to generate locust html file without UI?

locustfile = /mnt/locust/locustfile.py
headless = true
host = https://uat.xxx.biz
users = 1000
spawn-rate = 1
run-time = 25m
expect-workers=4
master
html=basic.html

I got error

master_1 | locust: error: unrecognized arguments: --html=basic.html

Edit

locust 1.4.1

docker run -p 127.0.0.1:8089:8089 -v $PWD:/mnt/locust tnt_locust:1.0.0 -f /mnt/locust/locustfile.py --headless -u 10 -r 10 --run-time 15s --html=basicNew.html

Same error as above.


Solution

  • config file should follow all of the document examples, key=value:

    # master.conf in current directory
    locustfile = locust_files/my_locust_file.py
    headless = true
    master = true
    expect-workers = 5
    host = ''
    users = 100
    spawn-rate = 10
    run-time = 10s
    html=base.html
    

    by your example, master value has been skipped

    and run it by command:

    locust --config=master.conf
    

    by the way, have tried without master and workers params?like:

    # master.conf in current directory
    locustfile = locust_files/my_locust_file.py
    headless = true
    host = ''
    users = 10
    spawn-rate = 10
    run-time = 10s
    html=base.html
    

    also, there's opportunity to generate html file adding to cli:

    locust -f locustfile.py --headless -u 10 -r 10 --run-time 15s --html=basicNew.html
    

    By the way, it's due to 1.4.1 version of locust, it didn't have HTML report yet. only from 1.4.2 it was added:

    1.4.2 Multiple improvements for charting including tooltips etc Added –html option to save HTML report docs.locust.io/en/stable/changelog.html#id3 Lots of other small fixes.

    Try to update version to 1.4.2 or latest one 1.4.3