Software Testing & QA (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is Snapshot Testing, and what are its legitimate use cases vs. anti-patterns?
junior LevelTesting
In Simple Words: Snapshot tests serialize a data structure or rendered component tree to a file on disk. Subsequent test runs compare new output against the stored snapshot.
- Legitimate Use Cases:
- Validating complex API JSON schemas or GraphQL AST outputs.
- Verifying generated code (e.g., compiler outputs, CLI generators).
- Anti-Patterns:
- Capturing massive 500-line DOM component snapshots. Developers blindly press
uto update snapshots without reading the diff, rendering tests useless. - Avoid snapshot testing for frequently changing UIs; prefer semantic behavior assertions.
- Capturing massive 500-line DOM component snapshots. Developers blindly press