up previous next contents index
Next: How to do Unit Up: Working Backwards with JUnit Previous: What should a test   Contents   Index

How you should apply Unit Testing (The test cycle in XP, Extreme Programming Installed)

The philosophy of ``working backwards''. (Write the code you want to see without worrying about the infrastructure that supports it.)

  1. Write one test.
  2. Compile the test. It should fail (because you haven't implemented anything yet).
  3. Implement just enough to compile. (Refactor first if necessary.)
  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 "once and only once".
  8. Repeat from the top.


up previous next contents index
Next: How to do Unit Up: Working Backwards with JUnit Previous: What should a test   Contents   Index