Skip to content
tezvyn:

End-to-End Testing: Simulate Real User Paths

MediumHow cards are made

End-to-end testing exercises the full stack through user flows, catching integration fractures unit tests miss. Run it in staging before releases to verify behavior. The trap is using it for fast feedback; it is slow, brittle, so never abandon unit tests.

Why it exists

Unit tests prove that functions behave in isolation, but production failures usually happen at the seams where services, databases, and third-party APIs meet. End-to-end testing exists to reproduce those seams by driving the application exactly as a user or client would, revealing mismatches in data contracts, networking, and configuration that no amount of mocked logic can surface.

The mental model

Think of the system as a highway with toll booths, bridges, and tunnels. Unit tests inspect each component in a garage; end-to-end tests send a car through the entire route to discover that a tunnel is too low or a toll booth rejects the new currency. It is a simulation of the complete journey, not a parts inspection.

How it works

An end-to-end test typically spins up the full application environment, including the frontend, backend, database, and any message brokers, then executes realistic workflows through public interfaces. For a web application this often means using a browser automation tool to log in, submit a form, and assert that the confirmation email arrives and the database reflects the new record. The test exercises real HTTP calls, actual SQL transactions, and genuine network latency rather than stubbed dependencies.

When to use it

Deploy it in staging pipelines before releasing to production, after unit and integration tests have already passed. It is also valuable after infrastructure changes, dependency upgrades, or environment migrations where the risk lies in composition rather than logic. Use it to validate critical user journeys such as checkout flows, account provisioning, or payment processing where failure is expensive and visible.

When not to use it

Do not rely on end-to-end tests for fast feedback during active development; their runtime is measured in minutes, not milliseconds. Avoid them when the failure can be caught cheaper by a unit test, a static type checker, or a contract test. They are also a poor choice for testing edge cases in algorithms or business rules that do not involve cross-system integration.

One canonical example

A SaaS platform runs an end-to-end suite every night against its staging cluster. The suite signs up a new user via the React frontend, triggers a Stripe payment through the API gateway, waits for a webhook to update the Postgres database, and verifies that the user receives a welcome email through a mailhog catcher. When the team upgraded their authentication provider, this suite caught a subtle redirect URI mismatch that unit tests with mocked OAuth clients had silently passed.

Interview question

A team wants to verify that a recent database schema change did not break the checkout process. Which testing strategy best fits this goal?

  • a.Add a static type check to ensure the schema migration file syntax is valid
  • b.Perform a contract test between the frontend and backend service layers only
  • c.Run a unit test suite that mocks the database and asserts the checkout function returns the expected DTO
  • d.Execute an end-to-end test that completes a purchase using the real frontend, API, and databaseCorrect
Why?

End-to-end testing is explicitly recommended after infrastructure changes and for critical user journeys like checkout because it exercises real database transactions and cross-system seams. A unit test with a mocked database cannot catch integration fractures between the application and the database.

Just read this? Test yourself on what you have been reading.

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles