Section: IT & Technology · Software DevelopmentDifficulty: Easy

Unit Testing

USUK

Testing individual units or components of code in isolation to verify they function correctly.

Definition

Unit testing is a software testing practice where individual units (functions, methods, or classes) of source code are tested in isolation to verify they behave as expected. Unit tests are small, fast, and fully automated. They form the foundation of the testing pyramid and provide rapid feedback during development. Test-Driven Development (TDD) writes tests before implementing code. Popular unit testing frameworks include JUnit (Java), pytest (Python), Jest (JavaScript), and NUnit (.NET).

Example

A unit test for a calculateTax() function verifies that calculateTax(1000, 0.2) returns 200, and calculateTax(0, 0.2) returns 0, covering all edge cases.

Synonyms

  • component testing
  • isolated testing
  • function testing

Antonyms / Opposites

  • integration testing
  • manual testing
  • no testing

Images

CC-licensed · free to use
More on Wikimedia
Loading images…

Video

  • integration-testing
  • tdd
  • cicd
  • automated-testing

Dictionary Entry

Back to IT & Technology