Test Driven Development

Before starting off with the coding process the developer is not concerned about what to write but his/her main concern is about how to resolve a problem and implement the right logic. A lot of books are available on coding skills but there is no help available on how a logic should be understood and implemented in software development. Keeping this in mind the concept of test driven development was established.

Test driven development or TDD is a very interesting concept designed for refinement of software design and development. In this scenario it is required to first design the test cases and then proceed with the coding process. This process follows a pattern of red, green and refractor meaning that first a code must be written to fail the test and then improvised to clear the test case and then based on what you have learnt you can then make changes in your code. The Red step involves writing code as per developer’s understanding; the test would fail which is indicated by the red color. In the green step the developer will work had to make the code pass the test somehow. Once the test is cleared the developer will move on to the refractor step in which the code will be cleaned and design will be improved.

The tester has to create test cases that define the exact output the system needs to produce in various scenarios. Once this is done, the developers have to create a code to fail the test and in this way “Red” step is achieved. Then make changes in the code to make it pass the step anyhow and this would clear the “Green” step. Now a developer will look at the work that you have done so far. Refine the code. Remove unwanted code from the program and then test the code again to see if it is behaving as per the requirement. In this way one can accomplish the Refractor step.  

There are several advantages of implementing the concept of test driven development. Since the developers are made to work on the code to pass the test, they would pay attention to every step and develop a code that is stable. It also helps in accounting for project completion. By looking at the number of tests passed you can calculate what percentage of the project has been completed. The process shifts the focus of the developers from the functionality of the application to the logic that needs to be applied thereby refining the designing ability of the developers.

It must be noted that test driven development is applicable only for testing code and not for the testing of user interface, database and external files. This concept must be implemented properly or else it can create complications and add to the project cost and complexity. The success of TDD greatly depends on the how highly skilled the developers are. This is a truly amazing concept and has been implemented by many leading IT companies in software development.