QamoosTech
Testing & QualityTypes of testsBeginner

Unit Test

PronunciationYOO-nit TEST

Definition

A small automatic test that checks one piece of code, like a single function, in isolation.

Where you hear it

Code reviews, CI pipelines, and job interviews.

Examples

  • Please add a unit test for the discount function.
  • All 120 unit tests passed in 3 seconds.
  • The unit test checks that the discount is zero for orders under 100.

Common mistake

Writing tests that depend on the network or database. A unit test should be fast and isolated.

Don't confuse with

A unit test checks a single isolated piece of code, while an integration test verifies how multiple components work together.

Say it at work

  • In a meeting or chatCan you make sure to write a unit test for this new helper function before we merge?
  • In an email or ticketI updated the unit test to cover the edge cases we discussed during the review.