โ† All CAD Flashcard Decks

Test-Driven Development (TDD) Flashcards

7 cards from real CAD practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Test-Driven Development (TDD) flashcards as text
  1. What is a 'test double' in TDD terminology?

    Answer: A generic term for objects that stand in for real dependencies in tests

    Test doubles (mocks, stubs, fakes, spies, dummies) replace real collaborators to isolate the unit under test.

  2. In TDD, what distinguishes a 'stub' from a 'mock'?

    Answer: Stubs return canned responses; mocks verify interactions occurred

    Stubs provide predetermined return values, while mocks additionally assert that specific calls were made.

  3. Which metric measures how much of the production code is exercised by tests?

    Answer: Code coverage

    Code coverage reports what percentage of lines, branches, or paths are executed during test runs.

  4. A team practicing TDD notices tests are slow and rarely run. The best corrective action is to:

    Answer: Profile and optimize tests, possibly replacing slow I/O with fakes

    Slow tests discourage frequent execution; isolating I/O with fakes or in-memory alternatives restores speed without losing coverage.

  5. What does 'Outside-In TDD' (also called London School TDD) emphasize?

    Answer: Starting from the outermost acceptance test and mocking collaborators inward

    Outside-In TDD starts with a failing acceptance test, then drives lower-level units by mocking dependencies not yet built.

  6. Which TDD anti-pattern involves testing implementation details rather than observable behavior?

    Answer: White-box over-specification

    Over-specifying internal implementation makes tests brittle; they break on valid refactors that don't change behavior.

  7. How does TDD relate to regression testing?

    Answer: The accumulated test suite acts as an automated regression safety net

    Every passing test built up through TDD becomes a regression check that runs automatically on subsequent changes.