Test Driven Development

Test-driven development (TDD) is a practice specific to software development that relies on automated tests to ensure high-quality code.

In TDD developers write a test for a feature or module prior to writing the actual code.

Programmers first write a test which ensures that the code they are writing does what they are supposed to, then they write the minimum amount of code that passes the test. The programmer may write another test to make sure the implementation is correct, then write the code to pass that test. After the programmer has written and tested each test, the tests are run against the program to ensure that the program does what it should.

Test Driven Development starts by focusing on a single feature in isolation, and mocking or stubbing out other code until it’s ready to become part of broader product.