From the course: Agile Software Development

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Test-driven development (TDD)

Test-driven development (TDD)

From the course: Agile Software Development

Start my 1-month free trial

Test-driven development (TDD)

- Another code practice of extreme programming is test driven development. Test driven development means you never write any code until you've written and failed a test for it. It is a three step process. The first step is to write a function for a test that has yet to be written. The code will not compile. The next step is to write the function so you have just enough code to make sure the code compiles. The test should fail. If the test passes, the test is inadequate to verify any functionality and should be refactored. The third and the last step is to complete coding of the function to meet requirements of the test. After you write each test, you refactor the code to meet the requirements of the test. Then you write another test and refactor the code to pass the test. This process continues until you have exhausted your list of tests, and your code is complete. The essence of test driven development is thinking about test scenarios before implementation. This may appear a little…

Contents