Skip to main content
Community

The 5 test anti-patterns that cost our team the most time — and how we fixed them

Ajitesh Mohanta
Ajitesh MohantaAmbassador
Jan 2, 2026 8,442 0
After a test suite audit last quarter, we identified the problems causing the most maintenance pain. In order: **1. Tests that assert on implementation, not behaviour** Example: asserting `user.save()` was called vs asserting the user appears in the DB. When implementation changes, 40 tests break for no reason. Fix: always assert on observable outcomes. **2. Fixtures that do too much** A single `test_user` fixture that creates a user, a subscription, 3 posts, and an API key. Every test got more than it needed. Fix: small, composable fixtures. Tests request only what they need. **3. Test helpers with assertions inside them** Helper function that clicks a button and then asserts the result. When the assertion fails, the traceback points to the helper, not the test. Fix: helpers return values; tests assert. **4. Magic sleep() calls** We had 47 `time.sleep(2)` calls. Total wasted time per run: ~94 seconds. Fix: proper waits and retries. **5. Tests that pass by doing nothing** A try/except that swallowed exceptions, or an assertion that was always True. Fix: mutation testing run — caught 12 of these in one pass.

Join the discussion

Sign in to join the discussion

Sign in