January 2020
Intermediate to advanced
548 pages
13h 36m
English
There are many tools, terms, and paradigms of testing. The existence of so much complexity can seem intimidating but it's important to remember that, at the core, testing is really just about making assertions about how something works.
Assertions can be made programmatically by expressing either SUCCESS or FAILURE depending on a specific outcome, as in the following example:
if (sum(100, 200) !== 300) { console.log('SUCCESS! :) sum() is not behaving correctly');} else { console.log('FAILURE! :( sum() is behaving correctly');}
Here, we will receive a our FAILURE! log if our sum function is not giving the expected output. We can abstract this pattern of success and failure by implementing an assert function, like so:
Read now
Unlock full access