Exception in task method is handled but not reported as a failure
See original GitHub issueDescription of issue
If an unhandled exception occurs in a task method it is handled by the framework and
tasks continue to be executed by the Locust but not reported as a failure. If you are
only looking at the final success / failure rate - perhaps programmatically - it is easier
to miss the exception. From the UI you can see exceptions more easily, and download
them as a CSV, but when running in --no-web
mode they are not logged.
Expected behavior
My proposal is
- an exception should be treated as a failure and logged as such.
- exceptions should be exported as a CSV when using
--no-web
Actual behavior
Exceptions are not treated as a failure - in fact tasks appear to have succeeded, and they are not logged to in the CSV outputs on --no-web
mode.
Environment settings
N/A
Steps to reproduce (for bug reports)
Write any task where the code after making the web request fails - perhaps asserting something on the output, or manipulating data it thought would be returned but wasn’t.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top GitHub Comments
Also, if I have a body of existing code used for testing support being able to just rely on standard python exceptions failing the test is a big plus.
Other than this little niggle Locust is perfect for our needs, I found it yesterday (JMeter casualty) and up and running in no time. Amazing work, a shining example of following the path of least surprise.
Thank you! Wayne
You should be able to implement it within your own test scripts by overriding the
TaskSet.execute_task
method, and firinglocust.events.request_success
events. However I’m -1 on including it in Locust itself.