Testing Errors, with a Fresh Start for Every Test

Tests for an API's error answers check the status code, the whole error body and that nothing changed, @pytest.mark.parametrize runs one test for each bad value, and an autouse fixture that resets the data gives every test the same fresh start, so the tests pass alone and in any order.

By

Updated

Cheat sheet: Testing Errors, with a Fresh Start for Every Test
Category
FastAPI
Level
Journeyman
Tags
409 Conflict, fastapi, Flaky Test, Parametrized Test, rest-api, Test Fixture (python), Test Isolation