Now, let's talk about the case when a snapshot test is failing due to an intentional implementation change.
Acum, să vorbim însă despre cazul în care un test eșuează din cauza unei schimbări intenţionate în implementare.
When a snapshot test fails, you need to inspect whether it is an intended or unintended change.
Atunci când un test de imagine eșuează, trebuie să inspectați dacă este vorba de o modificare intenționată sau neintenţionată.
Our snapshot test case is failing because the snapshot for our updated component no longer matches the snapshot artifact for this test case.
Test nostru de imagine eșuează deoarece imagine actualizată pentru componenta noastră nu mai corespunde cu imaginea de referință.
Now, every time the snapshot test case runs, () will return 1482363367071 consistently.
Acum, de fiecare dată când se execută testul, () va returna 1482363367071 în mod constant.
A typical snapshot test case for a mobile app renders a UI component, takes a screenshot, then compares it to a reference image stored alongside the test.
Un caz tipic de astfel de testare pentru o aplicatie de mobil, randează o componentă de UI, crează o imagine a ei, apoi o compară cu o imagine de referință stocată în timpul testului anterior.
It's straightforward to spot when a snapshot test fails after a bug has been introduced.
Actualizarea imaginilor Este evident atunci când un test eșuează după ce s-a introdus un bug.
If you'd like to limit which snapshot test cases get re-generated, you can pass an additional - testNamePattern flag to re-record snapshots only for those tests that match the pattern.
Dacă doriţi să limitați testele pentru care se vor regenera imaginile, puteţi specifica o opțiune suplimentară - testNamePattern pentru a re-înregistra imaginile doar pentru acele teste care se potrivesc cu modelul specificat.
Contenu potentiellement sensible ou inapproprié
Les exemples vous aident à traduire le mot ou l’expression cherchés dans des contextes variés. Ils ne sont ni sélectionnés ni validés par nous et peuvent contenir des mots ou des idées inappropriés. Signalez des exemples à modifier ou à retirer. Les traductions potentiellement sensibles, inappropriées ou familières sont généralement marquées de rouge ou d’orange.