Skip to content

Fixtures and test data

Most tests need a signed-in user. Rather than repeat the login flow in every test, OttoTester uses a fixture: a small Playwright spec that runs before your real tests. It signs in once, saves the session to a file, and every test after it starts already authenticated.

Fixtures are scoped by role. If your app has an admin, a tester, and a reviewer, you’ll have up to one fixture per role — and at most one fixture per role per variant.

These two are easy to mix up, so OttoTester keeps them distinct:

  • A fixture plan is a test case — the spec for a sign-in flow. The planner writes it; it has type: fixture and a role.
  • A fixture is the runtime script — the Playwright spec the generator produces from the fixture plan. It’s the thing that actually logs in.

It’s the same relationship as any test and its script: the plan is the spec, the fixture is the code.

Test data is whatever your tests read and write — seed users, sample records, the values a form expects.

OttoTester treats test data as its own object. You define it once on a variant, and tests reference it by name. Rotate a password or rename a record in one place, and every test that uses it follows — no hunting through scripts.