How do you know if the system you built works? Through testing it! But testing different aspects of your system manually (i.e. by entering text into input fields and clicking buttons yourself) can be tedious, and take up a lot of time. This is why developers rely on tools which run through a defined list of expectations to fulfill and alert the developer if one (or many) outcomes did not turn out as expected.
- Unit testing is where individual parts of an application (each 'unit') are tested in isolation from one another. So, for example, in a standard calculator app, you would test the
addfunction first to see if numbers add together and produce an expected result, and then the
subtractfunction to see if numbers subtract from each other and produce an expected result, and then the
- End to end testing is where the relationship between multiple parts of an application are tested. It simulates how the user would use the application, wherein multiple components are involved and rely on one another. As a simple example, when the user clicks on the "hamburger button" (component one), does the correct menu (component two) appear? For a more complex example, when the user submits data through a form (component one), is that data submitted to the database (component two) correctly?
Unit Testing + Integration Tools
Jest - developed and maintained by Facebook and contributors. Partnered most often with React but works just as well with other JS frameworks.
Mocha - more simple, and configurable. Ideal for developers who seek complete control over their unit testing environment.
End-to-End Test - Regression + Acceptance Testing