正解:A
Test-Driven Development (TDD) is a software development approach where tests are written before writing the actual code. TDD enables and encourages code refactoring because it ensures that tests are already in place to verify the correctness of the code after changes.
* Red-Green-Refactor Cycle: TDD follows a cycle of writing a test (Red), writing code to pass the test (Green), and then refactoring the code while ensuring the test still passes (Refactor).
* Refactoring Support: Because tests are written first, developers can confidently refactor code knowing that any changes that break functionality will be caught by the existing tests.
References:
* Test-Driven Development: TDD Overview