-
Notifications
You must be signed in to change notification settings - Fork 293
About Unit Tests
In computer programming, unit testing, a.k.a. component or module testing, is a form of software testing by which isolated source code is tested to validate expected behavior.
A unit test is a single function defined within a test suite that verifies the proper functioning of some "unit" of code within the product. "Unit" generally implies a relatively small amount of code; code that can be isolated from the rest of a codebase which may be a large and complex system.
A unit test specifies a starting state and expected result, and can be run manually or automatically (e.g. by the IDE or build system).
Unit testing is intended to ensure that the units meet their design and behave as intended.
By writing tests first for the smallest testable units, then the compound behaviors between those, one can build up comprehensive tests for complex applications.
One goal of unit testing is to isolate each part of the program and show that the individual parts are correct. A unit test provides a strict, written contract that the piece of code must satisfy.