Unit testing is a method of testing individual units of code. A unit can be defined as the smallest testable part of an application. Unit tests are short code fragments created during the development process. Unit testing verifies the behavior of a piece of code in isolation i.e., independent of its normal application context. A unit code can be as small as a class or even just a method.