> For the complete documentation index, see [llms.txt](https://ultimatewebsolutions.gitbook.io/qa-knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ultimatewebsolutions.gitbook.io/qa-knowledge-base/test-pyramid.md).

# Test Pyramid

<div align="left"><figure><img src="https://68936076-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKa5W2q6HA7EDVl7m4OHV%2Fuploads%2F7A1bTd92JP1pzEcq3Lrf%2Ftest_pyramid.png?alt=media&amp;token=11ce635b-c3ae-4365-9749-52beb531953c" alt=""><figcaption></figcaption></figure></div>

* **Unit Tests.** This bottom layer is the wide base, where the largest number of tests are performed. Unit tests are focused on the smallest testable parts of the code. We're talking about individual functions, methods, or classes, tested in complete isolation. They're incredibly fast and the most reliable to execute, pinpoint bugs with precision, and are generally cheaper to fix because you catch issues right as the code is being written.
* **API Tests.** Next, above unit tests are API (Application Programming Interface) tests. These tests verify the functionality of your application's APIs directly, bypassing the user interface. They check if the various services or modules within your system can talk to each other correctly. They're faster and more stable than UI tests because they don't rely on the visual elements of the application. This is like checking if the pipes and wires behind the walls are properly connected and sending the right signals. You'll have fewer of these than unit tests, but more than UI tests.&#x20;
* **Integration Tests.** Next up are Integration tests. These focus on how different modules, services, or how systems interact with each other. This is about verifying the interfaces and data flow between separate parts. Essentially, they connect layers and test real flows. For example, testing how your application interacts with an external database, a third-party service, or another microservice. They're slower than API tests, but still faster than UI tests, and they help uncover bugs that only appear when components are combined.&#x20;
* **UI Tests**. This is the top of the pyramid. UI (User Interface) tests, sometimes known as end-to-end tests, simulate a real user interacting with the application through its GUI (graphical user interface). They run through user workflows, from start to finish. While essential for verifying the full user experience, they are the slowest, most brittle, as they can break with small UI changes, and the most expensive to maintain. You want a small, focused set of these to confirm critical user journeys work as expected. This is about making sure the user can do the essential things with the product.&#x20;
