Test Driven Development (TDD) is more a development technique than a test technique. A developer may perform low level testing using the Test Driven Development, while a tester or product owner performs high level testing using Acceptance Test Driven Development (ATDD). Behavior Driven Development (BDD) can include both low level and high level tests.
Test Driven Development
Test driven development is a technique used to develop code guided by automated test cases. It is also known as test first programming, since test cases are written before the code. Test driven development includes:
- Add a test that captures the programmer’s concept of the desired functioning of a small piece of code
- Running the test, which should fail, since the code doesn’t exist
- Writing the code and running the test in a tight loop until the test passes
- Refactoring the code after the test is passed
- Repeating this process for the next small piece of code, running the previous tests as well as the added tests
The test cases written are primarily unit level and typically code-focused (white-box), though tests may also be written at the integration or system levels. Test driven development was popularized by Extreme Programming [Beck02] but is used in other agile methodologies and sometimes in sequential lifecycles. This development approach allows fixing coding defects as soon they are introduced.
Test driven development reduces the introduction of defects by helping the developer focus on the clearly defined expected results. The tests serve as a form of executed design specification for future maintenance efforts. The tests are automated and are used in continuous integration.
The text above is a sample from the upcoming Agile Tester Extension that will be released in early 2014. Please note that the Agile Tester Extension is in its beta phase, which means that its content may change. Visit www.istqb.org to get latest information.