Intermediate Vocabulary #testing #tdd #quality #engineering

Testing Patterns & TDD Vocabulary

5 exercises — mock/stub/spy/fake/dummy test doubles, TDD red-green-refactor discipline, property-based testing, diagnosing flaky tests, and consumer-driven contract testing with Pact.

0 / 5 completed
Testing vocabulary quick reference
  • Dummy = unused placeholder · Stub = returns canned data · Mock = verifies interactions · Spy = real + records calls · Fake = working simplified implementation
  • TDD: Red (failing test first) → Green (minimum code to pass) → Refactor (improve, stay green)
  • Property-based testing = define invariants, framework generates 100s of random inputs; tools: Hypothesis, fast-check
  • Flaky test = non-deterministic; causes: time dependency, shared state, real network, test ordering, async race conditions
  • Contract testing / Pact: consumer writes the contract · provider verifies it · no joint deployment needed
1 / 5
A test review says: "This is a mock, not a stub. And we shouldn't be using a fake here." What are the five test double types and when do you use each?