11 May, 2018

You might have heard a lot about Test Driven Development and Behavior Driven Development methodologies, but did you really bother to study the difference between the two?

So, without further ado, let’s get down to study:

Test Driven Development (TDD)

Test Driven Development, as the name suggests, is driven and run by a series of automated unit test cases to extract out the peak functional aspect of a specific feature. These tests fail naturally because developers write unit tests when the functional codes are unwritten. TDD is mostly used in agile workflows as it supports the product shipment at the end of test sprint.

Following are the important process components of TDD:

  • The developer writes the automated test cases subsequent to the instructions and requirement documents, leaving the production code unwritten.
  • The development team drives these automated test scripts with the support of currently developed modules and the test fails naturally. It is because writing test codes without any functional codes end with a vain and futile process. So be at ease and watch them fail flawlessly!
  • After finding the easiest solution, developers manage to refactor the code to create a verified deliverable product by the end of the sprint.

Nat Pryce and Steve Freeman’s book “Growing Object-Oriented Software, Guided by Tests” has a classic TDD cycle that explains the TDD loop as:

Write a failing test Pass the test Refactor and the cycle continues.

TDD tests the code’s ability to accept a given data and the probability of recovering it via refactor approach. But intrinsic computations may nullify any wide-reaching changes in the automated test cases and cost both money and time to the whole software development team.

Behavior Driven Development (BDD)

TDD is actually BDD done right. It can be referred to as a better implementation of TDD with more useful guidelines. It helps in defining user behavior through expert conversations, choosing particular tools and testing types. In fact, BDD is based on theory rather than being a running process. Putting it simply, BDD is expected to remove any glitches and problems associated with the TDD process.

It is communicated and programmed in an agile workflow where:

  • The business analyst highlights the user behaviors they expect to see functioning in the product or system.
  • These specifications are transformed into automated test scripts to run against the functional codes.
  • The developer makes queries about the defined user specifications according to their understanding of the concept defined by the business person and while writing functional codes in the development process. This step verifies the quality of the automated test scripts.
  • The tester tests the test cases and test scripts, may detect a bug in the code, and report it to the developer.
  • The development team thus refactors and organizes the functional code to produce a tested and verified deliverable at the completion of the sprint.

BDD can be driven and run by various CI tools such as Cucumber, Docker, PowerTools, FitNesse, etc. The test scripts and functional codes are written in simple English in Gherkin, Wikis etc.

Since the behavior-driven specifications are written in English, it puts all the stakeholders and the IT team on the same shared ground that lessens the chances of any fallacies and risks. BDD greatly helps in achieving the well-thought and actually experimented user-behavior.


TDD vs. BDD helped us realize that test-driven development is itself confusing. Because how can you test something that isn’t complete or built yet. Testing can’t be done on assumptions merely, while there are many other reasons to hail BDD:

  • BDD is simply written in plain English language that is easy to understand by all members of the team while TDD is written in complicated IT languages like Ruby on Rails, Java, Python etc.
  • BDD demonstrates the application behavior keeping in view the potential users, in contrast, TDD only focuses on functional implementation. This is how quality and CD can be more efficiently maintained in BDD as compared to TDD.

Acceptance and communication get easier with BDD, while TDD is dispersed and complicates team association. The comparison suggests that writing vague test cases is useless without specifying the user’s behavior towards a specific product.

Therefore, it’s more important to hang a hat on user-defined behavior which is only possible with the Business-Driven Development process.

About the author

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Leave a Reply

Your email address will not be published. Required fields are marked *