Performance: Test database strategies
MEDIUM IMPACT
This affects the speed and reliability of backend tests, impacting developer feedback loops and CI pipeline efficiency.
Use an in-memory database like SQLite or a dedicated test database with proper setup and teardown.
Use the production database directly for tests without isolation or cleanup.
| Pattern | Test Speed | Isolation | Resource Usage | Verdict |
|---|---|---|---|---|
| Using production DB without isolation | Very slow | No | High | [X] Bad |
| In-memory DB with transactions | Fast | Yes | Low | [OK] Good |
| Dropping schema each test | Slow | Yes | High | [X] Bad |
| Using minimal fixtures | Fast | Yes | Low | [OK] Good |