Test Data and Fixture
Testdaten und Fixture
Testdaten und Fixtures sind bekannte Eingaben und Einrichtungsschritte. Sie bringen das System für jeden Test in denselben Zustand.
Ein weiteres Beispiel
Ein Rechnungs-Testgerüst erstellt einen Kunden, zwei Artikel, eine feste Uhr und eine Steuerregel. Es löscht nur seine eigenen Daten.
Hauptteile
- 01Code or behavior under test
- 02Observable evidence
- 03Coverage, failure, and recovery
Verwenden Sie es, wenn
Verwenden Sie kleine Builder und separate Fixtures, damit wichtige Zustände klar und wiederholbar bleiben.
Nutze es nicht, wenn
Vermeide riesige gemeinsame Testdaten, kopierte persönliche Daten, Zufallswerte ohne Seeds und Aufräumarbeiten, die fremde Daten löschen.
In Code verwendeter Name
factory + deterministic clock + isolated cleanup Vor dem Ausliefern
Check the environment and prepared test data (fixture). Define a result you can observe, failure and edge cases, isolation, stable inputs, useful error details, and cleanup. Set a time budget, owner, and flaky-test rule.
Outcome: Complete the task with Testdaten und Fixture (Test Data and Fixture). User context: Ein Rechnungs-Testgerüst erstellt einen Kunden, zwei Artikel, eine feste Uhr und eine Steuerregel. Es löscht nur seine eigenen Daten. Validation approach: Testdaten und Fixture (Test Data and Fixture). Why it fits: Verwenden Sie kleine Builder und separate Fixtures, damit wichtige Zustände klar und wiederholbar bleiben. Do not use it when: Vermeide riesige gemeinsame Testdaten, kopierte persönliche Daten, Zufallswerte ohne Seeds und Aufräumarbeiten, die fremde Daten löschen. Test requirements: Name the system and test environment. Define prepared test data, other inputs, and the result you can observe. Include failure and edge cases, allowed error, isolation, and cleanup. Test operations: Make failures easy to diagnose. Control random or changing inputs. Name an owner. Keep the test fast and simple enough for its release gate. Acceptance criteria: The test fails for the known bug and passes after the fix. It repeats in the target environment, gives useful evidence, and does not expose or change unrelated data. Evidence and limits (evidence boundary): Kein einziger offizieller Standard kontrolliert den gesamten Begriff. Seine Bedeutung kann sich zwischen Teams, Plattformen oder Frameworks ändern. Unknowns to confirm: Release gate, environment, prepared test data, allowed error, time budget, owner, and flaky-test rule.
Diese Anfrage prüfen
Review how Testdaten und Fixture (Test Data and Fixture) is used now. Definition: Testdaten und Fixtures sind bekannte Eingaben und Einrichtungsschritte. Sie bringen das System für jeden Test in denselben Zustand. Release checks: Check the environment and prepared test data (fixture). Define a result you can observe, failure and edge cases, isolation, stable inputs, useful error details, and cleanup. Set a time budget, owner, and flaky-test rule. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.