Software Engineering Week 5

Unit Testing vs. End-To-End Testing

Unit testing is a type of testing that test individual units of code like functions, methods, or classes by themselves to ensure that they behave as intended in isolation. This allows us to catch bugs early in the development process. On the other hand, E2E testing is a type of test that tests the entire system from end to end by simulating user behavior and interactions. The goal of E2E testing is to make that the system works and meets the requirements of the end user.
The major differences between the two types of tests are scope, speed, dependencies, and debugging. Unit tests focus on individual sections of code in isolation whereas E2E tests generally test the entire system. Unit tests are a lot faster than E2E tests and can be run frequently. Unit tests rely on mocking or stubbing to simulate dependencies, whereas E2E tests require the full system to be running with all dependencies in place. Lastly, if a unit test fails it is significantly easier to debug.