Skip to content

SvenskaSpel/locust-plugins

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.

Locust Plugins

Build Status license PyPI PyPI GitHub contributors

The purpose of this project is to gather a curated set of plugins/extensions for Locust.

Locust itself is a "bare bones" load generation tool (compared to for example JMeter or Gatling) and it is left to the user to build even basic functionality (like reading test data from a database, using non-HTTP protocols, etc). This keeps Locust lean and mean, but forcing everyone to reinvent the wheel is not good either.

So I decided to publish my own plugins and hope that others (maybe you?) will contribute their solutions to common Locust use cases.

Having this separate from "Locust core" allows the plugins to evolve faster (at the expense of being less mature), and avoids bloating Locust with functionality you might not be interested in.

Installation

pip install locust-plugins

Then just import locust_plugins in your locustfile and use whatever plugins you need (see below)

Configuration

Most settings are configured from code, but some are exposed as command line arguments. You can list them by using Locust's regular --help argument:

locust -f any-locustfile-that-imports-locust_plugins.py --help

Plugins

Listeners

  • Listen to events and log things
    • Timescale: Log and graph results using TimescaleDB and Grafana dashboards (readme, source)
    • Print: Prints prints every request to standard out with response time etc (source)
    • Jmeter: Writes a jmeter-like output file (example, source)
    • ApplicationInsights: Writes the test logs to Azure Application Insights (example, source)
    • RescheduleTaskOnFail / ExitOnFail / StopUserOnFail: Perform actions when a request fails (source)

Users

Readers

Wait time

Debug

  • Support for running a single User in the debugger (moved to locust core!)

Transaction manager

  • Support for logging transactions (aggregating multiple requests or other actions) (example, source)

Connection Pool

  • Allows users to occupy more ports when running tests, useful for dealing with strange behaviour from load balancers in low user count high throughput scenarios. scenarios. (example, source)

Command line options

  • Additional locust command line options provided (examples, source)
    • Iteration limit (-i), stops Locust after a certain number of task iterations
    • Checks (--check-rps, --check-fail-ratio, --check-avg-response-time), gives an error return code if certain conditions are not met
    • Dashboards (--timescale, --grafana-url, --pghost, ...)

Further examples

Have a look at the example locustfiles to learn how to use the plugins.

har2locust

har2locust can be used to generate RestUser locustfiles directly from HAR-files (browser recordings). It is installed separately.

locust-swarm

These plugins work well together with locust-swarm

Contributions

Contributions are very welcome! 😁

For guidelines, see CONTRIBUTING.md

License

Copyright 2019 AB SvenskaSpel

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.