Skip to Content
Zurück zu: Observability Stack: Prometheus, Grafana, and Loki in Kubernetes
DevOps & CI/CD 7 min. read

Automated Testing in CI/CD: Which Test Pyramid Actually Works

The classic test pyramid is a good starting point — but in practice, CI/CD pipelines need a tailored approach. Our experience.

devRocks Engineering · 15. February 2026 · Aktualisiert: 31. March 2026
Testing CI/CD PHPUnit Quality
Automated Testing in CI/CD: Which Test Pyramid Actually Works

Rethinking the Test Pyramid

The classic pyramid says: many unit tests, few integration tests, barely any E2E tests. In practice with modern web applications, this does not always hold true.

Unit Tests: Fast but Limited

Unit tests are ideal for isolated business logic, calculations, and data validation. But they say nothing about whether your components work together.

Feature Tests: The Sweet Spot

In Laravel projects, feature tests (HTTP tests) are often the best compromise. They test the entire request lifecycle — from the route through the controller and middleware to the database — and still run in milliseconds.

  • Database Tests: Use LazilyRefreshDatabase for fast, isolated tests with a real database.
  • Factory States: Define meaningful factory states for different scenarios.
  • Assertions: Laravel offers powerful test assertions such as assertDatabaseHas(), assertRedirect(), and assertSee().

E2E Tests: Use Selectively

Browser tests with tools like Playwright or Dusk should be limited to critical user journeys: login, checkout, registration. They are slow and fragile — but indispensable for happy paths.

Pipeline Integration

In our CI/CD pipelines, unit and feature tests run in parallel, followed by E2E tests only on the staging branch. This keeps feedback cycles short without sacrificing safety.

Questions About This Topic?

We are happy to advise you on the technologies and solutions described in this article.

Get in Touch

Seit über 25 Jahren realisieren wir Engineering-Projekte für Mittelstand und Enterprise.

Weitere Artikel aus „DevOps & CI/CD“

Frequently Asked Questions

Unit tests are automated tests that verify isolated parts of the code, such as business logic and data validation. They are important to ensure that these components function as expected, even though they do not test the overall context of the application.
Feature tests, also known as HTTP tests, check the complete request lifecycle of an application. Unlike unit tests, they not only test isolated functions but also the interaction between different components and their integration into the application.
E2E tests should be specifically focused on critical user journeys such as login, checkout, and registration. Since they are time-consuming and prone to errors, they are only sensible when executed in the later stages of the CI/CD pipeline on the staging branch.
Modern web applications often require an adaptation of the classic test pyramid. Instead of just conducting many unit tests and few E2E tests, a variety of feature tests should be integrated, as they provide a better compromise between test coverage and execution time.
Pipeline integration allows for running unit and feature tests in parallel, which shortens feedback cycles and improves time-to-market. E2E tests should, however, only be conducted at specific stages, such as on the staging branch, to ensure that the application remains stable.

Didn't find an answer?

Get in touch