Test Driven Development

Programming for Search Engines 101. An area for avid PHP and .NET developers to chat about Programming techniques and how to make better use of search engines.

Moderator: Moderators

Test Driven Development

Postby Anil » Thu Oct 15, 2009 12:10 am

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.
Anil
 

Re: Test Driven Development

Postby beniston » Sun Jun 16, 2013 11:24 pm

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.
beniston
 
Posts: 502
Joined: Wed Nov 02, 2011 4:35 am
Location: Cochin
Tell us why you would like to become a WyseLabs Member:


Return to Programming

Who is online

Users browsing this forum: No registered users and 8 guests