Repaso
Español

The TDD cycle is…

Options

  1. Design, code and test, repeated in one long cycle
  2. Red (failing test), green (make it pass), refactor (Correct option)
  3. Test only after the release, then fix whatever failed
  4. Write all the tests first, then write all the code

Answer

Red (failing test), green (make it pass), refactor

Why

Test-Driven Development works in tiny loops:

  1. Red: write one small test for the next behavior. It fails, because the code does not exist yet.
  2. Green: write the minimum code to make it pass.
  3. Refactor: clean up the code while the test protects you.

Then repeat with the next small behavior.

Remember

Red → Green → Refactor.

Key terms

Practice this question in Repaso