Course contentsShow
← Software Engineering
Lesson 556 of 1,93317. End-to-End and UI TestingFree lesson

E2E Test Scope and Boundaries

Deciding what to include in E2E tests: frontend, backend, databases, external services, and testing environment setup.

E2E Test Scope and Boundaries

What you'll learn: How to decide what components and systems to include when designing end-to-end tests.

The Challenge of Drawing the Line

End-to-end tests verify that your entire application works together from a user's perspective. But "entire application" can mean different things. Should you test against real databases? Live external APIs? Your production infrastructure? Drawing clear boundaries determines whether your E2E tests are valuable or impossibly brittle.

What to Include

Think of E2E test scope like planning a dress rehearsal for a play. You need enough of the "real thing" to be confident, but not so much complexity that rehearsals become impossible.

Frontend: Always include your actual UI—the buttons, forms, and pages users interact with. This is non-negotiable for true E2E testing.

Backend: Include your real application server and business logic. Don't mock your own code—that defeats the purpose.

Database: Use a real database instance (often a separate test database), not an in-memory fake. You're testing that your queries, migrations, and data access actually work.

External Services: This is where boundaries get fuzzy. For critical third-party services (payment processors, authentication providers), consider using their sandbox/test environments. For less critical services, mocks or stubs might be appropriate to avoid flakiness and cost.

Testing Environment: Your E2E tests need an isolated, reproducible environment—separate from development and production. This might be containerized, cloud-based, or a dedicated staging environment.

Making the Trade-Off

The more "real" your E2E environment, the more confidence you gain—but also the slower, more expensive, and more fragile your tests become. Balance comprehensiveness with practicality.

Key Takeaway: E2E test scope should include your real frontend, backend, and database, while carefully deciding which external dependencies to test against real services versus test doubles based on criticality, cost, and reliability.