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
What does the 'Red' phase in the Red-Green-Refactor cycle indicate?
Answer: The test fails because the production code doesn't exist yet
Red means the newly written test fails, confirming the feature is not yet implemented.
Which practice does TDD most directly discourage?
Answer: Writing production code before any test exists
TDD mandates that a failing test must exist before production code is written.
In TDD, what is the purpose of writing only the minimum code to pass a test?
Answer: To avoid over-engineering and keep design emergent
Writing minimal code prevents premature optimization and lets design evolve from actual requirements.
A developer writes a test that passes immediately without any production code changes. This is called a:
Answer: Degenerate test
A test that passes without implementation changes is a degenerate (trivially-passing) test that provides no value.
What is 'triangulation' in the context of TDD?
Answer: Adding multiple specific examples to drive out a general algorithm
Triangulation means writing multiple concrete test cases to force a general, correct implementation rather than a hard-coded one.
Which statement best describes TDD's impact on software design?
Answer: TDD drives a loosely coupled, testable design as a side effect
Writing tests first naturally pressures developers to create small, focused, independently testable units with low coupling.
When should a developer refactor during TDD?
Answer: After all tests pass (Green phase)
Refactoring happens in the third phase, after tests are green, to improve code quality without changing behavior.