Test guides

Debugging load tests

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.

Use the Test Debugger

LoadForge has a free test debugger which will try to run your test and attempt to send several requests through it. Head over to the Test Debugger to continue.

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 unzip python3-pip libxml2-dev libxslt1-dev python3-dev


sudo pip3 install --prefer-binary locust pyquery uuid gevent websocket \
 Flask gevent-websocket greenlet itsdangerous Jinja2 linecache2 \
 MarkupSafe mock msgpack pyzmq==22.3.0 requests six traceback2 
 unittest2 websocket-client Werkzeug jsonpath-ng PyMySQL \
 sqlalchemy pg8000 xmltodict pandas oauthlib==3.2.0 splinter \
 requests-oauthlib websockets websocket-client beautifulsoup4 \
 web3 eth-account locust-plugins locust-plugins[appinsights] \
 opencensus==0.7.12 opencensus-ext-azure==1.0.6 Faker


locust -f example.py --host https://YOUR_HOST_HERE -u 10 -r 10 \
    --run-time 1m --headless

This will run a short 1-minute test with 10 sample users. You'll be able to see any errors and debug your test file.

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 will be happy to help you!

Previous
Examples