Red/Green/Refactor defines the process for implementing each test in the test list. The goal of this process is to work in small, verifiable steps that provide immediate feedback. William Wake, in his book Extreme Programming Explored (Addison-Wesley, 2001), details the programming tasks as follows:

  1. Write the test code.
  2. Compile the test code. (It should fail because you haven’t implemented anything yet.)
  3. Implement just enough to compile.
  4. Run the test and see it fail.
  5. Implement just enough to make the test pass.
  6. Run the test and see it pass.
  7. Refactor for clarity and to eliminate duplication.
  8. Repeat from the top.
Advertisements