A unit test is an automated test that verifies a small part of code, also called a unit, quickly and in isolation. The purpose of unit tests is to evaluate the behavior of these units.
It is important to be aware of what exactly counts as a unit and how to isolate them. A unit can be a class or a collection of classes that reflect the behavior of the system, no matter how granular. By isolation, it is meant that the unit tests act independently of each other by detaching certain dependencies with stubs and mocks. Dependencies which should be isolated are those that are shared among the unit tests and those that behave in a non-deterministic way, such as the current date or time.
For writing and executing unit tests, it is best practice to use unit testing frameworks as well as mocking frameworks for creating mocks and stubs.