Modern QA2026Assertions That Waste Time — tiles
Log inJoin
11 / 57 · 26 Testing Like a Senior · Assertions and Flaky Tests← prev⊞ allnext →☰ Read as one page

3.2Assertions That Waste Time

Anti-Pattern: Generic assertions like expect(result).toBe(true) or expect(status).toBe(200). When they fail, the error message is "expected true, received false" — telling you nothing about what went wrong.

Pattern: Diagnostic-first assertions that tell you why they failed, not just that they failed.

Example of the anti-pattern:

// Fails with: "Expected true, received false"
expect(response.success).toBe(true);

Example of the pattern:

// Fails with: "Expected status 200, received 503. Body: { error: 'Database connection timeout' }"
expect(response.status, `Body: ${JSON.stringify(response.body)}`).toBe(200);

Soft assertions — Collect multiple failures in a single test run instead of stopping at the first. Useful for form validation, where you want to know all the fields that failed, not just the first one.

Custom assertion helpers — Domain-specific assertions like expectValidOrder(order) that check multiple conditions and produce readable error messages. They embed your team's quality knowledge into reusable code.