Tuesday, 3 December 2013

What is Test Driven Development (TDD)?

  • Test-driven development (TDD) is an iterative development process.
  • The process relies on writing unit tests before creating the code that they validate.
  • The TDD process uses very short iterations, each adding a tiny amount of functionality to your software.
  • Each iteration has three phases, described by the TDD mantra, "Red, Green, Refactor".
  • TDD assists in creating high quality, well designed, loosely coupled and maintainable code that can be refactored with confidence.

Some development practices and methodologies lead to code that grows in complexity over time, with a corresponding decrease in maintainability. You may find that some projects are hard to modify, as adding new features might break existing functionality or cause subtle bugs that are difficult to rectify without introducing further defects. When you encounter such projects it may be difficult to incorporate small changes. Large refactoring operations can be near impossible.

If a project includes a high level of unit test coverage, meaning that most or all of the source code has tests to validate their functionality, it is likely to be easier to maintain. The key reason for this is that, in order to perform high quality testing, the code must be loosely coupled and is more likely to have a better design. In addition, you can confidently make changes to code that has a full set of tests, knowing that those tests will fail if you introduce errors.

Test-driven development (TDD) is an iterative development process that aims to achieve high standards of design, excellent testability of source code and high test coverage for your projects. As the name suggests, the process is driven by the creation of automated unit tests.

Related articles

What is TDD?

TDD Process

Dealing with bugs in TDD

No comments:

Post a Comment