nerdexam
Scrum

PSD · Question #46

The right time to refactor code using TDD is

The correct answer is A. After the tests passes. You should refactor as soon as possible, but before the tests passes it cannot be refactored, because then it is not esatablished just yet. So it would still be part of the first version if changes would be made then.

Test Driven Development

Question

The right time to refactor code using TDD is

Options

  • AAfter the tests passes
  • BWhen preparing legacy code for unit tests
  • CWhen I can see the debt building in the code
  • DAfter the tests fails

How the community answered

(28 responses)
  • A
    93% (26)
  • C
    4% (1)
  • D
    4% (1)

Explanation

You should refactor as soon as possible, but before the tests passes it cannot be refactored, because then it is not esatablished just yet. So it would still be part of the first version if changes would be made then.

Topics

#TDD cycle#refactoring#red-green-refactor#test driven development

Community Discussion

No community discussion yet for this question.

Full PSD Practice