Assertiot ovat testissä olevia lausekkeita, jotka tarkistavat, onko ehto tosi — varmistamalla, että todellinen tulos vastaa odotettua tulosta. Ne ovat ytimessä, kuinka testit määrittelevät läpäisyn tai epäonnistumisen: jos assertio epäonnistuu, testi epäonnistuu.
Mitä assertiot tekevät
An ASSERTION checks that something is as expected:
→ "assert that the actual value EQUALS the expected value"
→ if TRUE → the assertion passes; if FALSE → the assertion FAILS → the TEST FAILS
→ Assertions are how a test VERIFIES behavior (the "check" part of a test).
Yleiset assertiotyypit
(result).();
(obj).({ : });
(value).();
(value).();
(value).();
(count).();
(price).();
(array).();
(array).();
(text).();
( ()).();
(value)..();
