200-901 · Question #15
Which task is performed because the test-driven development approach is being used?
The correct answer is B. refactoring code that is covered by existing tests. Test-Driven Development (TDD) follows the Red → Green → Refactor cycle: first write a failing test, then write the minimum code to make it pass, then refactor the now-passing code to improve its design. Option B describes this refactor phase - improving code that is already…
Question
Which task is performed because the test-driven development approach is being used?
Options
- Atesting existing software before developing new code
- Brefactoring code that is covered by existing tests
- Cwriting code without committing any coding violations
- Dcreating test scenarios based on continuous development
How the community answered
(55 responses)- A4% (2)
- B95% (52)
- C2% (1)
Explanation
Test-Driven Development (TDD) follows the Red → Green → Refactor cycle: first write a failing test, then write the minimum code to make it pass, then refactor the now-passing code to improve its design. Option B describes this refactor phase - improving code that is already covered by tests, so regressions are caught immediately. Option A describes regression testing of legacy code, not TDD. Option C describes linting/style enforcement, unrelated to TDD. Option D reverses the TDD order - in TDD, tests are written before new code, not based on code that was continuously developed first.
Topics
Community Discussion
No community discussion yet for this question.