Locustfile Debugging


Overview

If you have errors in your locustfile your test will fail. These could be simple python parse errors, or actual issues with the definition of your test.


Test locally

You can ensure your script parses by writing it to a file locally, e.g. example.py and parsing it:

python -m py_compile example.py

Run a local locust test

You can also install locust as shown and then test file locally, in our example it's example.py:

sudo apt-get -y install python3-pip libxml2-dev libxslt1-dev python-dev
sudo pip3 install locust pyquery uuid gevent websocket Flask gevent-websocket greenlet itsdangerous Jinja2 linecache2 MarkupSafe mock msgpack pyzmq requests six traceback2 unittest2 websocket-client Werkzeug
locust -f example.py --host https://YOUR_HOST_HERE -u 10 -r 10 --run-time 1m --headless

Request support

You may also email us at hello@loadforge.com at any time should you need assistance with your locustfile. Or you could live chat us! The point is, get in touch and we'll be happy to help you! Alternatively there are loads of useful examples to copy snippets or entire tests from in our Locust Directory for you to browse.