Software development Process : TDD and BDD

Software development Process:

A software development process or life cycle is a structure imposed on the development of a software product. There are several models for such processes, each describing approaches to a variety of tasks or activities that take place during the process.
Two most known development process are:

TDD (Test driven development):

It is an iterative development process. In this process we first write test cases for our business requirement. Initially these test cases will get failed. After that we start writing the application code and retest the test cases. If some of the test cases are getting failed then we need to write the code for making those test cases passed. And this iteration will keep running till the time comes when all the test cases starts getting passed.

At last when all test cases passed that means all the business logic for which test cases written have been implemented and working as expected.

Benefits of Test Driven Development:

  • Test first environment for development turns out to be bug free code.
  • Each Iteration we write test cases and it turns out to be automated regression pack. It ensures that earlier features are working fine.
  • These test cases serves as documentation and helps in future reference.

Drawback of Test Driven Development:

  • It should be consider as a part of your project estimation.
  • The maintenance of test project is an overhead of a project.
  • Rewrite the test case when requirement got changed.

TDD tools : JUnit

BDD (Behavior driven development):

Behavior Driven Development approach of testing is an extension of Test Driven Development approach. Similar to TDD in BDD also we write test case first and then add the application code to make that test case get passed.

The major difference we will see here are:

  • Test cases are written in plain descriptive English language.
  • Test cases are more focused on the behavior of application and more user focused.

Benefits of Behavior Driven Development:

  • It is driven by business values.
  • It act as a bridge between Business & Technical language.

BDD Tools : Cucumber or SpecFlow

Cucumber:

  • It is a testing framework which supports BDD (Behavior driven development).
  • It defines the application in a plain simple English language called Gherkin(Feature file).
  • It is itself written in a ruby but can be used with any other language like java, c#, python etc.

Spec-Flow:

Spec-flow inspires from cucumber framework. It brings the same concept to the .Net world.

Need of cucumber (BDD Framework):

  • Cucumber directly interacts with the developer code but the tests are written in a language that is quite easy to understand by the stakeholders.
  • It removes many misunderstandings long before it creates any issues in the code.
  • It reduces the scope of rework.

Example of BDD feature file:

Feature: Blog post

Blog post should be easy and friendly

Scenario: Successful blog post
User should get a confirmation mail and the URL of recently posted blog

Given I have chosen to post a blog
When I post a blog with valid details
Then I should receive a confirmation email
And I should see a URL of recently posted blog

Scenario: Failure blog post
Someone tries to post a blog with incorrect details

Given I have chosen to post a blog
When I post a blog with invalid details
Then I should be told that the details are not correct
And I should be offered the option to correct the details

 

To know more about cucumber implementation, visit Cucumber with Java – Behavior Driven Development

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s