Ch. 22 · Software Testing

Unit, Integration and End-to-End Test Boundaries

Unit, Integration and End-to-End Test Boundaries. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

Test categories describe the boundary exercised. Small isolated tests and broader integration checks answer different questions and should complement each other.

Before you start

You should understand inputs, expected outputs and the boundaries of the component under test. State the risk a test should detect before choosing a tool or mock. Distinguish controlled dependencies from real integrations so the result does not imply more coverage than the test actually provides.

The practical goal is to reason through this situation: A pure pricing test checks rules; an API test verifies serialization, persistence and routing. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Name the exercised boundary

A pure function, repository and full browser journey answer different questions.

Step 2: Select risk-based coverage

Use local checks for rules and integration checks for important wiring.

Step 3: Avoid redundant imitation

Different test sizes should add evidence rather than repeat implementation details.

Worked scenario

A pure pricing test checks rules; an API test verifies serialization, persistence and routing.

A checkout calculation test verifies discounts without a database. A persistence integration verifies stored order and constraints. A critical browser journey checks that the form reaches the operation and presents its outcome. Passing the calculation test does not establish routing or gateway compatibility; each report should state the tested boundary.

Common mistake

Calling a test unit because it is fast does not describe which dependencies it exercises.

Verify the behavior

Map each test to one concrete failure it can detect.

Interview exercise

Choose tests for a checkout change.

Answer and reasoning

Cover calculation rules locally and the critical external contract through representative integration, avoiding redundant tests that assert the same detail.

Continue learning

Compare the scenario with the Software Testing interview questions and test your understanding with the Software Testing MCQs. For terminology and implementation details, consult the reference material.

More in Software Testing

read ✓Software Testing · hard

Test Reports and Honest Coverage Claims

Test Reports and Honest Coverage Claims. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readread →
read ✓Software Testing · hard

Testing Time with an Injected Clock

Inject a clock instead of calling the system time, freeze it in tests, and remove the sleeps that make tests flaky.

~2 min readread →
read ✓Software Testing · mid

Code Coverage and Its Limits

Read line and branch coverage as a signal, not a goal, and avoid the tests that chase the number without checking behavior.

~2 min readread →
esc