Component Test
Test del componente
Un test di componente posiziona una parte dell'interfaccia in uno spazio di rendering reale. Fornisce alla parte input e dati controllati, quindi verifica il suo comportamento.
Un altro esempio
Un ingegnere del sistema di design apre una combo box con 200 opzioni e uno stato di errore. La selezione tramite tastiera deve cambiare il valore e il suo stato accessibile. Uno screenshot del contenuto statico non può testare questo comportamento.
Parti principali
- 01Fixture della storia
- 02componente montato
- 03asserzione del browser
Usalo quando
Usa questo termine quando un comportamento dell'interfaccia utente richiede il rendering del browser ma non l'intero percorso del prodotto.
Non usarlo quando
Non usare test dei componenti al posto di test di integrazione o E2E per connessioni al di fuori di quel componente.
Nome usato nel codice
story fixture → mount → user action → assertion 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 Test del componente (Component Test). User context: Un ingegnere del sistema di design apre una combo box con 200 opzioni e uno stato di errore. La selezione tramite tastiera deve cambiare il valore e il suo stato accessibile. Uno screenshot del contenuto statico non può testare questo comportamento. Validation approach: Test del componente (Component Test). Why it fits: Usa questo termine quando un comportamento dell'interfaccia utente richiede il rendering del browser ma non l'intero percorso del prodotto. Do not use it when: Non usare test dei componenti al posto di test di integrazione o E2E per connessioni al di fuori di quel componente. 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): È ufficiale per quella fonte. Altre piattaforme o team potrebbero usare il termine in modo diverso. Unknowns to confirm: Release gate, environment, prepared test data, allowed error, time budget, owner, and flaky-test rule.
Controlla questa richiesta
Review how Test del componente (Component Test) is used now. Definition: Un test di componente posiziona una parte dell'interfaccia in uno spazio di rendering reale. Fornisce alla parte input e dati controllati, quindi verifica il suo comportamento. 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.