Software Testing & QA (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
Explain the Practical Testing Pyramid and Cost vs. Confidence Trade-Offs.
senior LevelCode ExampleTesting
In Simple Words: The Testing Pyramid (Martin Fowler / Mike Cohn) structures automated tests by execution speed, maintenance cost, and fidelity:
bash
/ \
/ E2E \ Peak: 10% (Playwright / Cypress)
/-------\ High confidence, slow ($5-30s), expensive, flakiest
/ Integ \ Middle: 20% (API, DB, Component, Testcontainers)
/-----------\ Balanced speed & realism ($100ms - 2s)
/ Unit \ Base: 70% (Vitest, Jest)
/---------------\ Ultra-fast (<5ms), deterministic, cheap to write & maintain
- Unit Tests (Base - 70%): Tests isolated pure functions and domain logic without external I/O.
- Integration Tests (Middle - 20%): Tests interactions between units, database queries, and HTTP middleware using Testcontainers or MSW.
- End-to-End Tests (Peak - 10%): Tests full browser user journeys through frontend, backend, and database stacks. Highest fidelity, but slowest and highest maintenance cost.