Software Testing Squad
All About Software Testing In One Place!
128 Members
Join this group to post and comment.
Gaurav Prasad
Gaurav Prasad
Computer Science
15 Jan 2019

Explain TDD (Test Driven Development)?

What is Test Driven Development (TDD) and what are its advantages or disadvantages?

3mos ago

I got introduced to the TDD approach of software development a few years ago. I first did not like the concept of Test Driven Development; because it looked liked much of an overhead. However, after working on a large project here at CrazyEngineers, I've found out that TDD has a ton of advantages over regular development. 

The TDD Approach

The TDD approach differs from regular development approach in a fundamental way. In regular development, the software developer typically determines the feature to be implemented based upon the product requirements and heads over to coding it right away.

The testing part is typically done after the feature has been implemented. The result of this approach is that the bugs are often discovered after the feature has been implemented and the developer has to back-trace the code to debug it.

However, in TDD (Test Driven Development), the developer will first write a test case for the feature and build unit tests. 

A unit test will simply determine the flow that should take place for the user. The idea is -

  1. Write the test case and relevant unit tests
  2. Run the test and let it fail
  3. The developer runs the failed test over and over to look at the output and fix the reported errors.

That looks like too much work, right? 

But think about it in this way - the developer does not have to really care about the flow anymore - and is guided by the tests throughout the feature implementation. 

Let me know if you'd like to have a real example of TDD. I'll create one to explain this in detail. 

PS: TDD is typically a development approach and not related to 'software testing' directly.