HomeArticlesThe Testing Strategy Pyramid: Unit, Integration, and E2E Done Right
Software Architecture

The Testing Strategy Pyramid: Unit, Integration, and E2E Done Right

10 min read429 words
The Testing Strategy Pyramid: Unit, Integration, and E2E Done Right — Sufi Khan Sulaiman

The testing pyramid is the most misunderstood concept in software quality. The idea: lots of fast, cheap unit tests at the bottom, fewer integration tests in the middle, very few slow, expensive end-to-end tests at the top. After building test strategies across Lorex, FLIR, and 1c Platform, I've seen teams invert the pyramid and suffer slow suites, flaky tests, and low confidence.

The Testing Pyramid

Unit tests (milliseconds, test one function, run on every commit). Integration tests (seconds, test multiple components, run on every PR). E2E tests (minutes, test the full system, run on deployment automation). The pyramid shape reflects the cost and speed tradeoff.

Unit Tests: The Foundation

One assertion per test (if it fails, you know exactly what broke). Descriptive names ("calculate_tax_returns_zero_for_zero_amount" not "test_tax_1"). Arrange-Act-Assert structure. No external dependencies (use mocks/stubs). At Lorex, we had 2000+ unit tests that ran in 8 seconds.

Integration Tests: The Middle Layer

Test that components work together: API endpoint + database transaction patterns, service + message broker, frontend + API. Use real dependencies but not the full production stack. At 1c Platform, we used containerisation with Docker Compose to spin up a database transaction patterns and broker for integration tests.

E2E Tests: The Top

Test critical user journeys (login, checkout, core flow). Not every edge case. At Lorex, we had 5 E2E tests: login, browse product, add to cart, checkout, view order. The E2E suite ran in 3 minutes; the unit suite ran in 8 seconds.

The Flaky Test Problem

Flaky tests (sometimes pass, sometimes fail) teach the team to ignore failures. Sources: timing issues (use explicit waits, not sleep), test order dependency (tests should be independent), shared state (each test cleans up), external dependencies (mock them). At FLIR, flaky tests were quarantined: 1 week to fix or delete. This prevented accumulation.

Test-Driven Development

TDD: Red (write a failing test), Green (write minimum code to pass), Refactor (improve while keeping green). The benefit: every line is tested, the test documents behavior, the code is designed for testability.

Coverage: A Metric, Not a Goal

100% coverage with bad tests is worse than 80% coverage with good tests. Branch coverage is more meaningful than line coverage. Critical path coverage is more valuable than overall. At 1c Platform, we set 80% threshold for new code. Existing code wasn't required to meet it, but modified code had to.

The Testing Culture

Tests are reviewed in PRs (a PR without tests is not merged). Test quality is discussed ("this test is testing the mock, not the code"). Flaky tests are fixed, not ignored. Testing is celebrated. Culture eats process. But process builds culture.

Sufi Khan Sulaiman

Sufi Khan Sulaiman

VP Technology & CTO with 25+ years building ecommerce platforms, enterprise systems, and AI solutions

Expertise across ecommerce strategy, cloud architecture, AI & machine learning, DevOps, and technology leadership. Led teams at FLIR Systems, Lorex Technology, 1c Platform, and Genetec.

References & Sources

Explore the Full Portfolio

This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.

The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.

For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.