In computer programming, unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine if they are fit for use. Intuitively, one can view a unit as the smallest testable part of an application. In procedural programming a unit could be an entire module but is more commonly an individual function or procedure. In object-oriented programming a unit is often an entire interface, such as a class, but could be an individual method. Unit tests are created by programmers or occasionally by white box testers during the development process.
Ideally, each test case is independent from the others: substitutes like method stubs, mock objects, fakes and test harnesses can be used to assist testing a module in isolation. Unit tests are typically written and run by software developers to ensure that code meets its design and behaves as intended. Its implementation can vary from being very manual (pencil and paper) to being formalized as part of build automation.
Read more about Unit Testing: Benefits, Separation of Interface From Implementation, Parameterized Unit Testing (PUT), Unit Testing Limitations
Famous quotes containing the words unit and/or testing:
“During the Suffragette revolt of 1913 I ... [urged] that what was needed was not the vote, but a constitutional amendment enacting that all representative bodies shall consist of women and men in equal numbers, whether elected or nominated or coopted or registered or picked up in the street like a coroners jury. In the case of elected bodies the only way of effecting this is by the Coupled Vote. The representative unit must not be a man or a woman but a man and a woman.”
—George Bernard Shaw (18561950)
“Is this testing whether Im a replicant or a lesbian, Mr. Deckard?”
—David Webb Peoples, U.S. screenwriter, and Ridley Scott. Rachel, Blade Runner, being tested to determine if she is human or machine (1982)