Test everything
Rules: tests reach state through production code paths, and critical runtime behavior has at least one test against the real runtime. Never weaken an assertion or timeout to go green. No paid API calls in tests: use fakes or recorded fixtures. Tests never act on real user data or external systems: parameterize paths, never submit real applications, never hit production. (high) Skipped tests are not passes, and a unit test is not proof that an end-to-end flow works. (low)
Size it
- One change: test the new behavior and its edge cases next to the existing tests, then run the suite.
- Coverage push or strategy: the steps below.
Steps
- Inventory: the test runners, commands, CI config, and what is covered today (coverage report if available). Run the full suite once and record the baseline: pass, fail and skip counts.
- Risk map: list the critical paths (auth, money, data writes, sync, the main user flow) and the most-changed files without tests. Those come first, not the easy targets.
- Write tests in the project's existing style and framework. No new framework without approval. Each test asserts behavior, not implementation details.
- End-to-end and visual: cover the main user flow in a real browser (Playwright), at the viewports the user cares about, in both themes for UI.
- Flaky tests: reproduce with repeated runs, fix the race or shared state; never just add
retries or sleeps.
- Playwright's
page.clock.pauseAt(t)can throw "Cannot fast-forward to the past" when page time has already passedt. ReadDate.now()from the page right before the call. If that exact error occurs, retry a few times with a fresh reading, and rethrow anything else. - Tests that fail only under load (frame timing, animation progress) get diagnostics in the assertion message, such as the measured values, frame gaps and elapsed time. Fix the cause from what the diagnostics show. Never loosen the threshold to make it pass.
- Playwright's
- Report the before and after counts from real runs, what is covered now, and the remaining gaps ranked by risk. Failing tests are reported as failing.