Skip to main content
InterviewHubPRO
Section Overview
Q2

Question 2 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

4%
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
  1. Unit Tests (Base - 70%): Tests isolated pure functions and domain logic without external I/O.
  2. Integration Tests (Middle - 20%): Tests interactions between units, database queries, and HTTP middleware using Testcontainers or MSW.
  3. 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.