Test-driven development: Difference between revisions

Content deleted Content added
No edit summary
Divided into Benefits/limitations and added more content
Line 1:
'''Test-driven development''' (TDD) is a programming technique heavily emphasized in [[Extreme Programming]]. Essentially the technique involves writing your tests first then implementing the code to make them pass. The goal of TDD is to achieve rapid feedback and implements the "illustrate the main line" approach to constructing a program.
 
== Requirements ==
In order for TDD to work in practice, the system must be flexible enough to allow for [[automated testing]] of code. These tests must also be simple enough to return a simple true or false evaluation of correctness. These properties allow for rapid feedback.
 
In order for TDD to work in practice, the system must be flexible enough to allow for [[automated testing]] of code. The system must also have testcases in place before TDD can be used. These tests must also be simple enough to return a simple true or false evaluation of correctness. These properties allow for rapid feedback. of correctness and design.
TDD offers more than just simple validation of correctness, but can also drive the design of a program. By focusing on the testcases first, one must imagine how the functionality will be used by clients (in this case, the testcases). Therefore, the programmer is only concerned with the interface and not the implementation.
 
== Benefits ==
 
Despite the initial requirements, TDD can provide great value to building software better and faster. It offers more than just simple validation of correctness, but can also drive the design of a program. By focusing on the testcases first, one must imagine how the functionality will be used by clients (in this case, the testcases). Therefore, the programmer is only concerned with the interface and not the implementation. This benefit is similar to [[Design by Contract]] but approaches it through testcases rather than mathematical assertions.
 
The power of TDD offers is the ability to take small steps when required. It allows a programmer to focus on the task at hand and often the first goal is to make the test pass. Exceptional cases and error handling are not considered initially. These extraneous circumstances are implemented after the main functionality has been achieved.
 
== Limitations ==
 
TDD cannot work in an environment where [[automated testing]] is not feasible. It is currently immature and faces a variety of problems posed by Darach Ennis.
 
* GUI
* Distributed Objects
* Database Schema
* Compilers and Interpreters from BNF to production quality implementation
 
----