What is a fixture in testing?

Updated May 6, 2026

Short answer

A fixture is fixed test data used to run tests consistently.

Deep explanation

Fixtures provide predefined inputs and expected states to ensure repeatable tests.

Real-world example

Using mock user data in authentication tests.

Common mistakes

  • Using live production data as fixtures.

Follow-up questions

  • Where are fixtures stored?
  • Are fixtures reusable?

More Unit Testing interview questions

View all →