Test Driven Development: An Introduction to TDD model

It becomes very confusing for them who are new to IT industry because we have different models for software development like Waterfall model, Linear mode, Agile model, DevOps model, Test Driven Development Model (TDD), Behaviour Driven Development Model (BDD) and Acceptance Driven Development (ADD) Model.

Today we are going to discuss one of the most demanding software development model, that is, Test Driven Development (TDD). It builds the base for Behaviour Driven Development (BDD). This is the first development model which primarily focusses on testing activities and development of the software processes which is based on the output of the testing activities.

Let’s discuss more on it…

What is Test Driven Development (TDD)?

Test Driven Development (TDD) is one of the most innovative approaches to developing a software program. Tests are first written in this software development technique before the application is fully developed.

Tests are executed first when code fails then code refactoring come in the picture and the process continues until the application exists with zero defect.

Test Driven Development Lifecycle

All the software development model has the lifecycle which follows start to end processes. We call it Software Development Lifecycle (SDLC). Let’s discuss Software Development Lifecycle of the Test Driven Development which we call it TDD Lifecycle.

Following the image describes the lifecycle of Test Driven Development.

Test Driven Development Lifecycle inviul

In the above image, we observe that TDD first starts with writing a test, further, execution of the tests undergoes. Here if tests pass then it goes back and adds another set of tests. In contrary, if it fails then developer makes minimal changes to the code which simply means as Refactoring. Hence, it again becomes ready for test and the process continues until a defect-free product is developed.

Thus, in a Nutshell, we define the following steps in Test Driven Development Lifecycle:

Step# 1: Writing a test

Step# 2: Test Execution

Step# 3: Identify failed test cases

Step# 4: Make minimal changes to the code (Refactoring)

Step# 5: Repeat again from step# 2

Differences between Test Driven Development and Traditional Software Development methodologies

Test Driven Development Model Traditional Software Development Model
It finds the same number of defects initially before development. Defect count is the same, even testing activities undergo after a fully developed product.
TDD 100% ensures that all the requirements are covered. Since it deals with the requirement as a whole which leads to backlogs and PCR.
Here the focus is on the live working of code in a production environment. It mainly focuses on Test case design, Test planning, walkthroughs, etc.
Test coverage is relatively higher, which is near about 100%. Test coverage is relatively lower because of time constraints.
It emphasizes the importance of testing in the software lifecycle. Similarly, it also has an in-depth emphasis on testing in the Software lifecycle.

What are the benefits of TDD?

Below listed items highlight some of the benefits of Test Driven Development:

  • Tests are mainly automated which saves lots of time from manual work
  • TDD incorporates testing against each bug found so there is minimal chance of failure in production
  • It reduces the timeline of regression testing
  • Code quality and code reusability are maintained at first position

What are some of the disadvantages of TDD?

Test Driven Development technique is not at all the 100% perfect technique, so let’s discuss some of its disadvantages too.

  • Uncomfortable for developers who are friendly with the traditional methodologies
  • It might be wastage of time for some of the developers
  • A developer should have good knowledge of Unit test framework to work efficiently with TDD
  • It is very difficult to work on frequently changing requirements
  • A large amount of time required to handle complex scenarios

Unit Testing tools for Test Driven Development

Some of the unit test frameworks which supports TDD are as follows:

  • JUnit
  • TestNG
  • DocTest
  • NUnit
  • PHPUnit
  • RSpec
  • PyUnit

Stay updated for more tutorials on BDD and Cucumber. Don’t miss to join our Facebook group for the latest updates on testing processes.

Suggested Readings:

Join Inviul fb group

2 Comments

Leave a Reply