Architecture

Test Pyramid

This section outlines our shared strategy how to conduct the distribution of tests and their amount using the testing pyramid approach to effectively balance speed, coverage and confidence on projects - this applies to each feature, user story, or the team's set of tests.

Hero image for Clean architecture

The testing pyramid is a guiding principle that helps us design test suites that are fast, scalable, maintainable, and fit the needs of each project. It illustrates when and how different types of tests should be written and by whom—from fine-grained unit tests at the base to broad end-to-end tests at the top. In practice, each layer serves a purpose, and striking the right balance according to the project needs helps us move faster without compromising quality.

Test Pyramid Layers:

  • Unit Test - Foundation
    • Scope: Individual functions, methods, and classes
    • Purpose: Catch logic errors early, fast feedback during development
    • Characteristics: Fast, isolated, no external dependencies
    • Goal: High coverage, easy to maintain, form the bulk of your test suite.
  • Integration Test - Middle Layer
    • Scope: Multiple components interacting together (e.g. API + DB)
    • Purpose: Ensure all parts of the system work correctly when tested end-to-end
    • Characteristics: Run from UI perspective the same as end users with real data only
    • Goal: Focus on critical user journeys and regressions, and keep this layer thin and manageable for business automation & maintenance.
  • End-to-End (E2E) Tests - Top
    • Scope: Multiple components interacting together (e.g. APP + API + DB)
    • Purpose: Ensure all parts of the system work correctly when tested end-to-end
    • Characteristics: Run from UI perspective the same as end users with real data only
    • Goal: Focus on critical user journeys and regressions, and keep this layer thin and manageable for business automation & maintenance.

The mission for our clients is always to design the testing pyramid to deliver features quickly, safely, and with confidence — while keeping test suites lean and maintainable.

Test Pyramid Best Practices

  • Start writing tests early (even before code)
  • Automate the bottom pyramid layers first
  • Limit E2E testing scope to high-value flows
  • Use mocks/stubs only to isolate API services
  • Monitor test flakiness and test execution times regularly

Why the Test Pyramid Works

  • Speed: Most tests are fast unit tests → fast feedback, fewer delays
  • Stability: Tests closer to code are less sensitive than UI tests
  • Cost-effective: Less time spent maintaining flaky or expensive tests
  • Confidence: Layering tests builds confidence from the inside out

Pyramid Variants by Platform

Backend Testing Pyramid

  • Many fast unit tests for service logic
  • Focused integration tests for API + DB flows
  • Fewer end-to-end contract or API consumer tests

Frontend Testing Pyramid

  • Unit tests for components, formatters, and logic
  • Integration tests for UI logic (e.g. widget/component tests)
  • E2E tests for full workflows (e.g. login, checkout)

Conclusion

Planning & building the testing pyramid upfront helps project teams make smart, scalable decisions about structuring their test coverage. Whether you're designing tests for a single feature or a full project release, applying pyramid thinking ensures you're testing smart — not just testing more.


Copyright © 2025. All rights reserved.