Testing Strategies
Studies in this cluster, in series order. Each one keeps its own URL.
Testing
Pyramid, contracts, property-based tests, doubles, and flakes you can defend in interviews.
Testing Strategies
7 studies- 1.Testing Strategies — Pyramid, Contracts, Property-Based & FlakesChoose the cheapest test that would have caught the bug. Pyramid/Trophy allocate effort; contracts protect boundaries; property/fuzz find edge cases mocks miss; doubles need discipline; flakes destroy trust.
- 2.Test Pyramid & Testing Trophy — Unit vs Integration vs E2EUnit = fast/narrow; integration = real collaborators; E2E = journeys but slow/flaky. Trophy shifts effort toward integration. Avoid ice-cream cone (mostly E2E).
- 3.Contract Testing — Consumer-Driven Contracts vs Schema ContractsConsumer-driven (Pact) vs provider schema (OpenAPI/AsyncAPI/Protobuf) vs shared-env e2e. Contracts catch breaking API changes in CI without staging.
- 4.Property-Based & Fuzz Testing — Generators, Shrinking & InvariantsGenerators + invariants + shrinking find edge cases example tests miss. Hypothesis (Python) and fast-check (TS); fuzz parsers/protocols.
- 5.Test Doubles — Mocks, Stubs, Fakes, Spies & When Not to MockMock/stub/fake/spy/dummy (Meszaros). Over-mocking couples tests to implementation; prefer fakes/testcontainers for domain logic.
- 6.Flaky Tests — Isolation, Time, Concurrency & QuarantineRoot causes: time, randomness, shared state, async races, order dependence, externals. Quarantine vs fix; retries hide bugs; freeze clocks and isolate state.
- 7.Load, Chaos & Production Validation — Shadow Traffic, Canaries & Game DaysLoad checks capacity and latency. Chaos checks graceful failure. Shadow traffic, canaries, synthetics, and game days sit above the pyramid, always with an SLO abort and a blast-radius limit.