Page 1 of 1

Test Driven Development

PostPosted: Thu Oct 15, 2009 12:10 am
by Anil
Test Driven Development is a way to develop software by starting the process by collecting a requirement, developing test cases for the requirement, followed by the coding process. On the other hand, traditional approaches perform testing after the coding is completed.

While TDD is well suited for developing complex projects with minimum defects, it may not be necessary for small projects.

How does it Work?

For TDD to work, we will have to use automated testing tools. Test cases are created using an automated testing tool and then write the code that causes the automated test(s) to pass. The steps are:

1. Collect and fully understand the requirements

2. Create automated test(s) that test the requirement

3. Create the coding logic - test teh functinality by running the automated test(s)

4. Once the automated test(s) pass, then the logic is implemented to fulfills the requirement[*]

5. Re-factor the code for better maintainability, run the automated test(s) again to ensure it still works

Advantages of TDD

Studies have shown that Test Driven Development reduces defect density, improves software quality, and in some cases make team productivity higher.

Re: Test Driven Development

PostPosted: Sun Jun 16, 2013 11:24 pm
by beniston
Its good especially to have this for long term projects..

http://net.tutsplus.com/tutorials/php/l ... pp-in-php/

TDD has three core rules:
- You are not allowed to write any production code, if there is not a failing test to warrant it.
- You are not allowed to write more of a unit test than is strictly necessary to make it fail. Not compiling / running is failing.
- You are not allowed to write more production code than is strictly necessary to make the failing test pass.