Skip to main content
Basic Technical IVT

unit test

An automated test that verifies the behaviour of a single, isolated unit of source code — typically a function or class method — independent of external systems.

Full Definition

Unit tests are the foundation of automated test suites, designed to validate individual functions or methods in isolation from databases, networks, and other external dependencies (which are replaced by mocks or stubs). They run quickly, provide precise failure attribution, and are typically written by developers alongside the code being tested. Editors must distinguish 'unit test' from 'integration test' (which tests interactions between components) and 'end-to-end test' (which simulates real user workflows). As a noun phrase, 'unit test' is two unhyphenated words; as a compound modifier, hyphenate: 'a unit-test framework'. The verb form is 'unit-test' (hyphenated): 'to unit-test a function'.

Usage

Usage note: Two words as a noun ('write a unit test'); hyphenate as a modifier ('unit-test coverage') or verb ('unit-test this module'). Do not confuse with 'integration test' or 'end-to-end test', which involve multiple components or full system flows.

In Context

  • "Each unit test should cover a single code path and assert one specific outcome to keep failures easy to diagnose." — Testing best-practices guide
  • "The project maintains 90% unit-test coverage, measured on every CI run." — Engineering quality report

Also known as

unit spec spec

Contrasted with

integration test end-to-end test manual test

Don't confuse with

integration test end-to-end test smoke test

Editors from these organisations have used our services since 1998

Reuters BBC Oxford University Press Penguin Random House Springer Microsoft Suncor Energy United Nations Fisher Investments IBM The Home Depot KODAK CHEVRON