Snapshot Testing
syrupy (Python)
pip install syrupy
def test_api_response(snapshot):
resp = client.get("/api/users")
assert resp.json() == snapshot
First Run
Creates snapshot file. Subsequent runs compare.
Update Snapshots
pytest --snapshot-update
Best For
- API response shapes
- Serialization output
- Error message formatting