MortenB
MortenB

Reputation: 3547

locust remove expected error trans (401) from summary report

In order to make the locust performance test as natural as possible, I only issue token if it does not exists or has expired, but this results in a 401 unauthorized, then I issue token and retry.

How can I get those out of my list and statistics because in this scenario they are not errors.

Error report
 # occurrences      Error
--------------------------------------------------------------------------------------------------------------------------------------------
 4                  GET /Users?filter=username eq "{ssn}": HTTPError('401 Client Error: Unauthorized for url: /Users?filter=username eq "{ssn}"')
 4                  DELETE /Users/{id}: HTTPError('401 Client Error: Unauthorized for url: /Users/{id}')
 4                  POST /Users: HTTPError('401 Client Error: Unauthorized for url: /Users')
--------------------------------------------------------------------------------------------------------------------------------------------

Upvotes: 0

Views: 1046

Answers (1)

Solowalker
Solowalker

Reputation: 2856

You can override what Locust thinks is success or failure. Using a with block, you can change the response before it completes and is reported to Locust. See this section of the Locust docs for examples:

https://docs.locust.io/en/stable/writing-a-locustfile.html#validating-responses

Upvotes: 2

Related Questions