These tests are meant to run locally and verify the most fundamental bits of logic in your code. Why should I use them? Whether it be a function, a class, or anything else, unit tests are meant to test every feature/potential logical path. In fact, writing a unit test for every possible flow of your code is called 100% code coverage
Unit Testing vs Functional Testing. Both Unit Tests and Functional Tests are done to identify defects, prevent them and thus, deliver a quality product. Below are the differences between Unit Testing and Functional Testing.
.