QA Interview Hub · Knowledge base · Quizzes · Українська

QA Fundamentals › Types of testing

How does integration testing differ from end-to-end?

Integration testing checks how components interact through their interfaces, while end-to-end runs a full user scenario through the deployed system. Many integration checks are needed because they are fast and show where the failure is, while e2e tests are few and only for critical scenarios. Mocks encode the developer's assumptions, so a neighbour's contract is checked against a sandbox or with contract tests.

QA Fundamentals · Types of testing

All integration tests are green, yet the user cannot pay. What did they not check?

The team has a hundred integration tests and all of them pass. After a release card payment fails: the provider returns the amount as a string while our code expects a number. The tests with mocks did not see it, and there was no end-to-end payment scenario in the suite. This lesson covers what exactly an integration test checks, what e2e does, why one does not replace the other and where each ends.

How it works and why. Integration testing checks the interaction of components through their interfaces: front end and API, service and database, our back end and the payment provider. It looks for defects at the joints: data format, API contract, timeouts, handling of a neighbour's errors. The rest of the system may be replaced with stubs. End-to-end runs a full user scenario through the deployed system with real integrations: registration, top-up, transfer, statement.

In ISTQB CTFL 4.0 integration is two levels: component integration (interaction of components inside the system) and system integration (interaction with other systems, such as a provider). End-to-end is not a level in the syllabus but a way of testing: such scenarios belong to system testing. In practice the word e2e is used for any UI test through the whole system.

How much of the chain a check covers

UIAPIPaymentProviderintegrationintegrationintegrationend-to-end: the whole user path
Figure 1. An integration check takes two neighbouring nodes, e2e the whole chain. The wider the coverage, the slower it is and the less precisely it points at the cause.

Hence the trade-off known as the test pyramid: many integration checks are needed (fast, precise, easy to reproduce), few e2e (slow, less stable, but they prove the most important scenarios work as a whole).

Integration and end-to-end

Integration

Coverage: two or three components.

Speed: seconds.

A failure points at the joint.

Count: many.

End-to-end

Coverage: the whole user path.

Speed: minutes.

A failure says "something in the chain".

Count: only key scenarios.

Figure 2. It is not "better or worse" but different questions at a different price.

Example: why the mock missed the bug. The integration test with the provider uses a mock that returns:

{ "status": "ok", "amount": 100.5 }

The real provider in its sandbox returns (shortened):

{ "status": "OK", "amount": "100.50", "currency": "UAH" }

The status is in a different case and the amount is a string: our code compares status === 'ok' and adds the amount as a number, so the payment ends in an error. The mock encodes the developer's assumption, not the real contract, so the test is green. A check against the provider's sandbox (or a contract test) would have found the mismatch at once and shown the exact place. An e2e payment scenario would have found it too, but only reporting "payment failed" without saying where, and much later.

Limits and alternatives. Mocks drift from reality as soon as a provider changes its format: protection against that is contract tests (consumer-driven contracts) and periodic checks against the sandbox. A provider's sandbox is not production: limits, delays and rare errors differ. A neighbour's faulty responses (503, timeout, partial body) are easiest to reproduce in integration tests with a controlled stub, because e2e cannot cause them reliably. End-to-end tests are useful where the integrity of the path matters (payment, registration) and harmful when used to check every validation.

Common mistakes.

  • Covering everything only with e2e: the suite is slow and unstable, and failures are hard to localise.
  • Mocking every neighbour and calling it an integration test: the joint is not checked.
  • Checking every field validation in e2e: the same is faster and more precise at lower levels.
  • Not testing neighbour failures (timeout, 5xx, a slow response): in production these hurt the most.
  • Calling any UI test e2e: the coverage must be a full path, not a step.

Check yourself

A payment provider returns 503 in 10% of cases. Which test shows that our service behaves correctly?

Answer

An integration test with a controlled stub that returns 503, a timeout and a slow response: we check retries, the message to the user and the absence of a double charge. e2e with a real provider will not reproduce such failures reliably.

An automated test goes through login via the UI on a deployed stand with a real database. Is it integration or e2e?

Answer

It is e2e (system level): a full path through the UI and deployed components. If the test checked only the joint of two components (for example a service and the database) in an isolated setup, it would be integration. The label depends on coverage, so in a team it is useful to name the boundaries, not the word.

In the interview. Junior: Integration testing checks the joint of several components, for example how our back end works with a payment provider. End-to-end checks the whole user path through the system. Middle/Senior: There are many integration tests, they are fast and show where the problem is, and there are few e2e tests, only for critical scenarios. I do not trust mocks as proof of a contract: I add checks against a sandbox or contract tests. By ISTQB integration is two levels (component and system integration), and e2e is rather a way of system testing.

More articles in this chapter