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.