Unit testing tests individual components. Each test runs in isolation, and tests only a single item, such as a function or method. This function or method is considered the unit.
An example of a unit test is shown below. This test is describing a system where we may have a database model that represents information about various novels. We are testing to verify that the getHorrorRating method of the model works correctly. This method should return an integer between 0 and 5 describing how high that novel rated in the "Horror" genre.
As our example, we pull a Stephen King novel, as King is largely known as a Horror author.