Test Double
Doppio del test
Un Test Double sostituisce una vera parte del sistema. Stubs, fakes, spies e mock offrono controllo o visibilità.
Un altro esempio
Un test di spedizione usa un finto corriere con tariffe fisse. Una spia controlla che un ordine accettato programmi un solo ritiro.
Parti principali
- 01Code or behavior under test
- 02Observable evidence
- 03Coverage, failure, and recovery
Usalo quando
Scegli il doppio più semplice che stabilizza un confine o rivela un contratto importante.
Non usarlo quando
Non simulare il tuo stesso grafo di chiamate, copiare bug delle dipendenze o sostituire un test di integrazione prezioso.
Nome usato nel codice
stub / fake / spy / mock Prima di spedire
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 Doppio del test (Test Double). User context: Un test di spedizione usa un finto corriere con tariffe fisse. Una spia controlla che un ordine accettato programmi un solo ritiro. Validation approach: Doppio del test (Test Double). Why it fits: Scegli il doppio più semplice che stabilizza un confine o rivela un contratto importante. Do not use it when: Non simulare il tuo stesso grafo di chiamate, copiare bug delle dipendenze o sostituire un test di integrazione prezioso. 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): Nessun singolo standard ufficiale controlla l'intero termine. Il suo significato può cambiare tra team, piattaforme o framework. Unknowns to confirm: Release gate, environment, prepared test data, allowed error, time budget, owner, and flaky-test rule.
Controlla questa richiesta
Review how Doppio del test (Test Double) is used now. Definition: Un Test Double sostituisce una vera parte del sistema. Stubs, fakes, spies e mock offrono controllo o visibilità. 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.