Le asserzioni sono istruzioni in un test che verificano se una condizione è vera — controllando che il risultato effettivo corrisponda al risultato atteso. Sono il nucleo di come i test determinano il successo o il fallimento: se un'asserzione fallisce, il test fallisce.
Cosa fanno le asserzioni
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).
