Unit tests are low level tests that measure the input and output of a single function orÂ class. Tests are written in a completely isolated environment where all the input values are specified and the class being tested does not communicate with other parts of the system. Each unit test has its output values compared against the expected results. Tests are written from a developers perspective who knows the details of the system.
Unit tests don’t tell you if your application is stable, but it can tell you if the unit tested classes or functions perform exactly as intended.
In some ways, functional tests are the opposite of unit tests because they are high level tests for actions users can perform on the system. They could be adding an item to a shopping cart or editing your profile. Functional tests are written from a users perspective to complete a task.
These tests confirm the system can successfully complete that task; this could be the store item appearing in your cart, or changes to profile actually being saved.