intermediate7 h 30 min15 lessons

Testing in Practice

The testing that shows up in real codebases: suite structure, unit and integration boundaries, fakes and fixtures, API and browser automation, flakiness, CI, coverage, visual and accessibility checks, and the metrics worth reporting.

by DevFox

Start course

What you will cover

  1. Structuring a Test SuiteHow a suite is laid out decides whether people run it. Naming, grouping, shared setup, the fast/slow split, and keeping the failure message enough to diagnose from.30 min
  2. Unit Tests That Earn Their KeepThe difference between testing behaviour and testing implementation, why the second kind fails on every refactor, and how to pick the unit worth isolating.30 min
  3. Integration Tests and Their SeamsWhere to cut a system so an integration test is both realistic and fast: the seams worth testing across, and the ones that are really end-to-end tests in disguise.30 min
  4. Faking External ServicesThird-party APIs are slow, rate-limited and occasionally down. Stubs, fakes, recorded responses and local doubles — and how to notice when your fake has drifted from reality.30 min
  5. Test Data Fixtures and FactoriesShared fixtures rot and duplicated setup hides intent. Factories with sensible defaults, building only what the test is about, and making the interesting value obvious.30 min
  6. Database State and IsolationTests that pass alone and fail together are almost always sharing state. Transactions, truncation, per-test schemas and why ordering dependence is a bug in the suite.30 min
  7. Testing an HTTP APIStatus codes, headers, schemas and error bodies — testing the contract rather than the handler, including the authorisation cases everyone forgets.30 min
  8. Browser Tests With PlaywrightEnd-to-end tests that are not a liability: auto-waiting instead of sleeps, one user journey per test, tracing a failure, and running the same spec across browsers.35 min
  9. Locators and Page ObjectsWhy CSS-path selectors break every sprint. Locating elements the way a user finds them, test ids as a deliberate contract, and page objects that help rather than hide.30 min
  10. Killing Flaky TestsA flaky test is a bug report about your suite. The four real causes — timing, shared state, ordering, real non-determinism — how to reproduce each, and why retries are not a fix.30 min
  11. Running the Suite in CIGetting from works-on-my-machine to a signal the team trusts: what runs on a pull request versus nightly, caching, artefacts on failure, and keeping the pipeline honest.30 min
  12. What Coverage Does Not Tell YouLine, branch and path coverage, what each measures, and why a 90% number can sit on top of tests that assert nothing. Using coverage as a question, not a target.25 min
  13. Visual and Snapshot TestingCatching the change no assertion describes. Snapshot tests and their rot, visual diffs and their noise, and how to keep either from becoming a rubber stamp.30 min
  14. Accessibility Checks in the PipelineWhat an automated audit can catch, the much larger part it cannot, and how to wire the machine-checkable half into CI without pretending the job is done.30 min
  15. Bug Triage and Quality MetricsRunning triage so the queue stays meaningful, and choosing measures that survive contact with incentives — escaped defects and time-to-detect over test counts and pass rates.30 min