Search code examples
pythonperformance-testingreportinglocust

How to improve LOCUST reporting interface?


I use locust testing tool and it provide web interface with results. Unfortunately I don't see any option to how to:

  • store web-presented metrics, for comparison with future results
  • generate html report

Is anyone who knows how to find a sollution?


Solution

  • If you're using a recent version of Locust, in the web interface you can go to the Download Data tab and click Download Report and it will generate an HTML report for you to view. There's another link there to actually download it.

    Alternatively, you can tap into Locust event hooks to send off the data to another DB or whatever storage you want for future results comparisons. You can find one example here:

    https://github.com/SvenskaSpel/locust-plugins/blob/8233457b8e0a3c014d822e2399f67eeaf710e816/locust_plugins/listeners.py

    It's a complex example but does work (you could use that directly if it worked with the DB you wanted to use). You can piece together your own for whatever you want to do using EventHooks directly. For example, you can define functions called when certain Locust events happen, such as request_success where you can do stuff with each individual request's data or worker_report if you run in distributed mode and want to aggregate data and connections to your DB.

    Or lastly, if you really wanted to dig in and do your own custom UI work, you can extend the Locust web UI with just about anything you want so you can generate your own custom reports or whatnot.