Skip to content

About Unit Tests

Sleet01 edited this page Apr 29, 2024 · 2 revisions

What is "Unit Testing"?

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.

What is a "Unit Test"

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).

How do Unit Tests help?

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.

More Information

Running Unit Tests

Writing Unit Tests

Clone this wiki locally