Unit testing is a testing method that individually verifies the smallest units of a program, such as functions and methods. By replacing external dependencies with mocks, it allows for rapid validation of the target logic in isolation.
The "unit" in unit testing varies in granularity depending on the language or framework. It may refer to a single function, or it may refer to an entire class or module. What they have in common is the principle of "testing with external I/O (DB, network, file system) excluded."
External dependencies are replaced with mocks or stubs — for example, returning Supabase query results via a mock object, or replacing API calls with stubs. This keeps execution time within milliseconds, allowing hundreds to thousands of tests to be run on every commit in a CI pipeline.
Because mocks can return objects with arbitrary properties, they cannot detect inconsistencies with the DB schema. The incident where "all tests are GREEN but production throws a column does not exist error" is not uncommon. Unit tests are strong at validating business logic, but consistency at system boundaries needs to be supplemented with functional tests or E2E tests.
TDD (Test-Driven Development) is a development methodology that leverages unit tests as a "design tool." By writing tests first, the input/output specifications of a function are finalized before implementation. Since the existence of unit tests is a prerequisite, the two are closely intertwined.


Functional testing (feature testing) is a testing method that verifies system behavior in terms of specific features or use cases. It covers a broader scope than unit testing, confirming that multiple modules work together correctly.

TDD (Test-Driven Development) is a development methodology in which tests are written before implementation code, repeating a short cycle of test failure (RED) → implementation (GREEN) → refactoring (Refactor).

Acceptance testing is a testing method that verifies whether developed features meet business requirements and user stories, from the perspective of the product owner and stakeholders.


Closing the "Invisible Attack Vector" in AI Chat — An Implementation Guide to Preventing Prompt Injection via DB

ATDD (Acceptance Test-Driven Development) is a development methodology in which the entire team defines acceptance test criteria before development begins, automates those tests, and then proceeds with implementation.