nerdexam
Cisco

200-901 · Question #550

What is a principle of test-driven development?

The correct answer is A. write and run tests before writing new code. Test-Driven Development (TDD) follows a 'Red-Green-Refactor' cycle: first write a failing test (Red), then write the minimum code to make it pass (Green), then clean up the code (Refactor). The defining principle is that tests are written before the production code. This ensures

Software Development and Design

Question

What is a principle of test-driven development?

Options

  • Awrite and run tests before writing new code
  • Bwrite tests after adding new blocks of code
  • Crun tests after writing new code
  • Dwrite documentation for tests

How the community answered

(31 responses)
  • A
    90% (28)
  • C
    3% (1)
  • D
    6% (2)

Explanation

Test-Driven Development (TDD) follows a 'Red-Green-Refactor' cycle: first write a failing test (Red), then write the minimum code to make it pass (Green), then clean up the code (Refactor). The defining principle is that tests are written before the production code. This ensures every piece of code has a corresponding test, encourages better design decisions, and provides immediate feedback on whether new code works as intended. Writing tests after the code (choices B and C) is the opposite of TDD, and writing documentation (choice D) is unrelated to TDD methodology.

Topics

#Test-Driven Development#Software testing#Development methodologies

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice