Software testing is organized around three principal levels of scope, each targeting different parts of the system. A unit test verifies the behavior of a single, isolated piece of code such as a function or method. It runs in milliseconds, uses mocked or stubbed dependencies, and is deterministic and repeatable. An integration test, by contrast, checks that multiple components work correctly together, exercising real interactions between modules, services, or layers. This may involve real databases, APIs, or file systems, which makes such tests slower than unit tests but more effective at catching interface bugs. End-to-end, or E2E, tests simulate real user workflows across the entire application stack, validating the system from the user's perspective using tools like Playwright, Cypress, or Selenium. They are the slowest and most brittle test type, but they catch integration issues that span the whole system.
The relative number of these tests is captured by the Test Pyramid, a strategy popularized by Mike Cohn. The pyramid recommends a large base of unit tests because they are fast, cheap, and numerous; a middle layer of integration tests with moderate speed and count; and a thin top layer of E2E tests that are slow, expensive, and few. The idea is to have many small, fast tests providing rapid feedback while still covering the full stack with the slower tests.
Tests can also be classified by how much they know about the implementation. Black-box testing validates functionality without reference to the internal code structure, relying instead on requirements and specifications, where the tester sees only inputs and outputs. White-box testing, in contrast, uses knowledge of the source code to design tests around code paths, branches, and logic. Unit tests are typically white-box, while E2E tests are commonly black-box, and both perspectives are needed for comprehensive coverage. Finally, acceptance testing verifies that the system meets business requirements and is ready for delivery, with user acceptance testing validating real-world scenarios and business acceptance testing confirming business rules, often automated through BDD tools.