End-to-End Test
- In Turkish
- Uçtan Uca Test
In short
An end-to-end test is an automated test that runs a complete user journey through the whole application, from the user interface to the database and back.
What is an end-to-end test?
An end-to-end test, often shortened to E2E test, checks that a whole application works from a user's point of view. It performs a realistic task, such as signing up, adding an item to a cart, and checking out, and verifies that each step produces the right result across the frontend, backend, and database.
E2E tests for web apps usually rely on a browser automation tool that opens a real or headless browser (one that runs without a visible window), clicks buttons, fills in forms, and reads what appears on the page. The application runs in an environment close to production with real services connected, so the test exercises the same paths a customer would.
An analogy is a test drive: instead of inspecting each part of a car, you drive it around the block and confirm it gets you where you want to go. Because E2E tests are slow, need a full environment, and can fail for reasons unrelated to your change, teams usually keep a small number of them for the most critical flows, like login and payment.
E2E tests are often confused with integration tests. An integration test checks a few components working together behind the scenes, while an E2E test drives the entire system through its real interface. E2E tests give the most confidence per test, but they are also the slowest and the most likely to become flaky.
Key takeaways
- E2E tests simulate real user journeys through the full application.
- Web E2E tests typically automate a real or headless browser.
- They are the slowest and most expensive tests, so keep them for critical flows.
- They sit at the top of the testing pyramid, above unit and integration tests.
Example
test("user can log in and see the dashboard", async ({ page }) => {
// Drive a real browser exactly like a user would
await page.goto("https://app.example.com/login");
await page.fill("#email", "ada@example.com");
await page.fill("#password", "correct-horse");
await page.click("button[type=submit]");
// The user should land on the dashboard
await expect(page.locator("h1")).toHaveText("Dashboard");
});Readers ask
What does E2E stand for?
E2E stands for end-to-end. An E2E test checks an application from one end, the user interface, to the other, the database and external services, in a single realistic scenario.
Why are end-to-end tests slow and flaky?
They start a full application, drive a real browser, and depend on networks, timing, and test data. Any of these can cause delays or random failures, which is why E2E suites are kept small and wait for specific elements instead of using fixed delays.
See also
- Integration TestTesting & Quality, p. 12An integration test is an automated test that checks whether several parts of a system, such as code, a database, and an API, work correctly together.
- Unit TestTesting & Quality, p. 35A unit test is a small, automated check that verifies one function, method, or class behaves correctly in isolation from the rest of the program.
- Flaky TestTesting & Quality, p. 10A flaky test is an automated test that sometimes passes and sometimes fails without any change to the code, which makes its results hard to trust.
- Regression TestingTesting & Quality, p. 22Regression testing is the practice of re-running existing tests after a code change to make sure that features which used to work have not broken.
- Web BrowserWeb Development, p. 57A web browser is an application that fetches web pages from servers and turns their HTML, CSS, and JavaScript into the interactive pages you see on screen.
- CI/CDDevOps & Cloud, p. 9CI/CD is a set of automated practices that build, test, and release code changes frequently, so software can be delivered to users quickly and safely.
- PlaywrightTesting & Quality, p. 19Playwright is Microsoft's open-source framework for end-to-end testing and browser automation, driving Chromium, Firefox and WebKit through one API.
- CypressTesting & Quality, p. 7Cypress is a JavaScript framework that runs end-to-end and component tests for web apps inside the browser, with automatic waiting and an interactive runner.
- SeleniumTesting & Quality, p. 23Selenium is an open-source suite of tools for automating web browsers, used mainly for end-to-end testing, with its WebDriver API available in many languages.
Spotted a mistake or something missing on this page?Suggest an edit