Skip to content

FAQ

Frequent questions about fixtures: how they differ from a test double, when to share them, and how they relate to factories.

Is a fixture a test double?

No. A test double replaces a collaborator. A fixture prepares the world, and it can contain doubles.

Fresh or shared?

Fresh by default. Share only when the setup is genuinely expensive and the fixture is immutable.

Fixture vs factory?

A factory builds objects inside the test, visible in code. A fixture file is loaded from outside, visible only if you open it.

Do fixtures belong in the repository?

Small, deterministic fixtures yes. Large database dumps no; generate them from a seed script.