Database Testing / Quiz

Seed Discipline

Idempotent seeds, fixtures vs factories, and the logged random seed: the habits that make 'works on my machine' mean something.

Difficulty
Easy
Format
Quiz
Points
100
Estimate
9 min

// MISSION BRIEF

Your Mission

Seed data is infrastructure: when it drifts, every test built on it drifts too. This quiz covers idempotent seeding, fixtures vs factories, isolation strategies between tests, and reproducibility when randomness is involved.

Scoring: timed quiz; accuracy first, speed bonus for fast clean runs.

// FIRST CONTACT

Battle teaser

Running the seed script twice should:

  1. AFail loudly; seeds are single-use
  2. BDouble every row; more data is more coverage
  3. CDrop the database first, always, everywhere
  4. DConverge to the same state, via upserts (e.g. INSERT ... ON CONFLICT DO UPDATE) keyed on stable identifiers, not duplicate or crash
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

test-datadatabase-testingseedingfixtures