Unit tests are tests that are testing the smallest possible pieces of code in isolation.
What then is a unit?
The term unit comes from mathematics. The number 1 is considered the unit as it is the smallest natural number. It is the smallest whole positive number.
By analogy, a unit of your source code is the smallest piece of code that is logically separate from the rest of the code. It is a whole piece, a logically distinct area code, and it is the smallest possible such piece.
In most programming languages your unit is going to be a function or method call.
The great thing about unit testing is that if your code is structured in small independent pieces then writing tests for them can be quite easy. This ease-of-writing means that unit testing can be done as you develop features.
In comparison to other forms of testing, the execution time of unit tests is quite small. This means that you can run unit tests very frequently. As software matures a suite of unit tests is a powerful tool for preventing regressions and easing maintenance costs.
But unit testing is not the only game in town. There are also integration tests and performance tests and much more.
It is interesting though that unit in the term unit testing has this relationship to the unit in number theory.
What do you think?