On all but the smallest projects, developers must work together. The more smoothly you can do this, the greater your chance of success. Everyone contributes to the project, so XP devotes several practices to improving teamwork. These practices reinforce good programming habits by guiding less experienced developers and keeping everyone on track.
Goal: to prove that the code works as it should.
Adopt test-driven development. Write a test that fails. Write code to pass the test. Check that the test passes. Refactor the code. Automate your tests. Keep them passing. Use failing tests to prompt you to write code. This cycle produces a natural rhythm of rapid feedback.
Traditional testing is difficult, especially when you’re testing your own code. There is tremendous pressure for success. Writing a test that fails can be disheartening. It’s easy to rush through tests after you’re “done,” expecting that everything works correctly. Test-driven development is different. Tests are supposed to fail; there’s no code yet to make them pass! Writing the code to pass the test will give you a nice sense of accomplishment.
A feature is finished when all of its tests pass. Untested features do not exist. “Known issues” reduce that sense of immediacy, making debugging more difficult. Therefore, test failures should reflect only the last few minutes of changes to the system. Expected failures open the door for developers and ...