Files
Jon Chery 496303471d docs(milestone): complete v0.1 — initial framework
---ci---
project: atelier
phase: 7
milestone: v0.1
status: complete
phase_role: final
milestone_complete: true
requirements:
  covered: [ATELIER-01, ATELIER-02, ATELIER-03, ATELIER-04, ATELIER-05, ATELIER-06, ATELIER-07, ATELIER-08, ATELIER-09, ATELIER-10, ATELIER-11, ATELIER-12, ATELIER-13, ATELIER-14, ATELIER-15, ATELIER-16, ATELIER-17, ATELIER-18, ATELIER-19, ATELIER-20, ATELIER-21, ATELIER-22, ATELIER-23, ATELIER-24, ATELIER-25, ATELIER-26, ATELIER-27, ATELIER-28, ATELIER-29, ATELIER-30, ATELIER-31, ATELIER-32, ATELIER-33, ATELIER-34, ATELIER-35]
  partial: []
ship:
  milestone: v0.1
  type: NFR
  tag: v0.0.7
  merge: milestone/v0.1-atelier -> main
  release: https://git.cloudinit.dev/cloudinit-bot/atelier/releases/tag/v0.0.7
---/ci---

Milestone v0.1 — Initial Framework (NFR, complete).
8 core principles (C1-C8), 11 domains, 110 domain principles, 27 derived docs, 4 good + 3 bad examples, 4 language docs, full matrix, 3 review docs.
All 35 requirements covered. 7 patches (v0.0.0 pre-execution through v0.0.7 final). v0.0.7 IS the v0.1.0 milestone release.
2026-08-05 00:36:55 +00:00

2.2 KiB

Test Fixtures — Derived Rules

Derives from domains/testing/first-principles.md P7 (Realism), P2 (Independence), P3 (Determinism).

Fixtures are Real Data (P7 Realism)

  • A fixture resembles production data in shape, distribution, and edge cases.
  • A fixture with name: "test" and email: "a@b.c" hides bugs that real data surfaces.
  • Use realistic names, realistic emails, realistic dates. "Jane Doe", "jane.doe@example.com", "2026-03-15".

Factory Over Fixture (P2 Independence, P3 Determinism)

  • A fixture file is shared state. A factory is fresh state per test.
  • Prefer factories (e.g., factory.User() returning a new instance) over shared fixture files.
  • A shared fixture is mutated by one test, breaks another. Independence is violated.

Builders for Complex Data

  • A builder (UserBuilder().withEmail().withAdmin().build()) composes only the fields the test needs.
  • A builder with defaults: every field has a sensible default; tests override only what they test.
  • A builder is the test's API to data. Stable, composable, readable.

Setup and Teardown (P2 Independence)

  • Every test cleans up after itself. No test leaves state for the next.
  • setUp/tearDown (or beforeEach/afterEach) restore the world.
  • A test that depends on the order of execution is not independent.

Determinism (P3)

  • No Date.now(), no Math.random() in fixtures. Inject the clock, inject the RNG.
  • A fixture that uses "now" is non-deterministic. It passes today and fails tomorrow.
  • Fix timestamps: createdAt: new Date("2026-01-01T00:00:00Z").

Edge Case Fixtures (P9 Edge Case Coverage)

  • A fixture set includes: the empty case, the single-item case, the max-size case, the unicode case.
  • A fixture set includes invalid data: malformed email, negative age, future date.
  • Edge case fixtures are first-class, not "extra credit."

What Violates Fixture Discipline

Violation Principle
name: "test" fixture P7 Realism
Shared fixture file mutated across tests P2 Independence
createdAt: new Date() (now) in fixture P3 Determinism
No edge-case fixtures P9 Edge Case Coverage
A 500-line fixture file P3 (complexity)