Describe what the component contains
A pricing helper can be tested directly without rendering a screen. A price editor component may combine that helper with inputs, validation messages, and submit behavior. Rendering the component checks connections that a pure function test cannot establish, while still avoiding the full application and its routing or authentication setup.
State whether the component test uses a simulated document or a real browser. The distinction matters for layout, focus, and browser-specific behavior. Neither label alone tells a reviewer what environment ran, so include the runtime and replaced dependencies in the test design alongside the expected visible outcome.
Choose assertions through the public interface
For a quantity selector, enter a value and check the displayed total or emitted result. Avoid relying on private component fields when a user-facing assertion answers the requirement. Internal assertions can couple the suite to implementation details and create failures during refactoring even when the interaction remains correct for users.
Control remote data so the component can render loading, success, and error states deterministically. Keep a separate integration check for the real endpoint contract. A mocked response makes interface behavior reproducible, but it cannot show that the actual server still returns the shape the component expects to receive.
Combine focused logic and rendered checks
Use direct unit tests for the complete input matrix of a calculation. Select component examples that verify input wiring, validation display, and submission. This gives each layer a distinct purpose and avoids repeating every mathematical boundary through a rendered interface that adds little new evidence about the calculation itself.
Add a complete application journey when the risk depends on routing, global providers, or real service integration. Component checks cannot establish that the assembled application supplies the correct permissions and data. Use the smallest boundary that can detect the failure, and make any remaining integration gap explicit in the coverage plan.
Working sheet
| Behavior | Useful boundary | What it cannot establish alone |
|---|---|---|
| Price formula | Direct unit | Input wiring |
| Validation message | Rendered component | Live API contract |
| Focus behavior | Browser component | Whole-app navigation |
| Purchase journey | End-to-end | Every calculation boundary |
Questions about unit testing vs. component testing
Are all component tests integration tests?
Terminology varies. State the rendered boundary and real dependencies instead of relying only on a label.
Should component tests inspect private state?
Prefer public outputs and user interactions when they can establish the intended behavior.
How should I use the working sheet?
Download the CSV and replace the sample rows with evidence from your repository. Record a clear acceptance check and an owner for each item. Keep unresolved assumptions visible rather than treating the example as a completed assessment.
Sources and further reading
Examples are illustrative. They are not customer results, security guarantees, or a substitute for checking the documentation for your installed version.
