Framework architecture

Page objects vs fixture-based composition, API-driven setup/teardown, config/environment layering, reporting. Interviewers ask you to whiteboard yours.

About 22 min read3-question knowledge check

The mental model

A test framework is the kitchen behind the restaurant, not the plated dish. Anyone can write one test that passes — that's cooking one meal. A framework is the mise en place: the prep stations, the recipe cards, the ingredient supply, the plating standard, the way a new cook is onboarded. When an interviewer says "whiteboard your framework", they are asking to see your kitchen, because the kitchen is what determines whether the hundredth test is as cheap to write as the first, or whether the suite collapses under its own maintenance weight.

The analogy that sticks: a framework is plumbing, not fixtures. The tests (fixtures — taps, showers) are what users see; the framework (plumbing — pipes, pressure, shutoffs) is what makes adding a new tap a five-minute job instead of a re-plumb. Good plumbing is invisible when it works and catastrophic when it's absent: without it, every new test duplicates setup, hard-codes environment details, and re-implements waiting — and a UI change forces you to edit fifty files instead of one.

The one idea that separates a framework from a pile of scripts: the layer of indirection between what a test says and how it's done. A test should read like a sentence — "log in as an admin, create an order, assert it appears in the queue" — and say nothing about CSS selectors, base URLs, retry counts, or how auth works. Every one of those is a how, and every how belongs behind an abstraction (a page object, a fixture, a config layer) so that when it changes, it changes in exactly one place. The most common junior mistake is putting hows in the test; the most common over-engineering mistake is building indirection for hows that never change.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision