All glossary terms
Verify

Test fixture

A test fixture is the prepared state required to run a test — input data, mocked dependencies, configured environment, seeded database rows. Fixtures separate the 'arrange' setup from the 'act' and 'assert' phases of the test, making the test's intent clearer.

Fixture quality is a leading indicator of test-suite quality. Good fixtures are small (only the data the test needs), focused (one fixture per scenario, not one giant shared one), and named meaningfully (validOrder, expiredCoupon, suspendedUser). Bad fixtures are large (every test loads the same 200-row dataset), generic (a fixture used across 50 tests with subtle variations), or magic (the test fails when a seemingly unrelated field changes). Fixture design parallels test design: if writing a clear fixture is hard, the underlying code is often too coupled.

Related terms