All IT Courses 50% Off
QA Tutorials

BDD Behaviour Driven Development

BDD, Behaviour driven development is an Agile software development process, where in the software teams work to fill the gap between business people and people from technical background by the means of below tasks: 

  • Encouraging cooperation across roles to build shared understanding of the problem to be solved
  • Working in small iterations and fast to increase flow of value as well as feedback.
  • By producing system documentation that is automatically checked against the system’s behaviour

The activity has three steps, iterative process:

  1. It is done by taking a small upcoming change to the system(as user story) and talk about concrete examples of the new functionality to explore, discover and agree on the detailed information of what’s expected to be done.
  1. By documenting those examples in a way that it can be automated and check for agreement.
  2. Finally implement the behaviour described by each document

These practices can be called as Discovery, Formulation, and Automation

diagram of how the practices fit together

Discoverywhat it may do:

The goal of BDD is valuable, writing software and it helps teams to have a right communication at the proper time as we can minimise the time for meetings and utilise the time to produce amount of valuable code.

Formulation what it should do:

Here we can formulate the every example of discovery sessions as structured documentation which gives us a quick way to confirm that we really have shared understanding of what to build.

Automation-what actually it does:

By taking one example at a time we can automate it by connecting to the system as a test. Automated examples work like guide-rails and helps us to keep our development work on track.

BDD Association with cucumber:

The cucumber documentation states as, BDD narrows the communication and also gap between team members to foster better understanding of the customer and encourage continuous communication with real world examples.

Cucumber is a tool based on Behaviour driven development methodology. The main goal of BDD is to make many different projects so that Business analyst, quality assurance, developers understand the application without diving deep into technical aspects.

How to setup selenium cucumber Java BDD Framework?

  1. Goto eclipse to create a project
BDD Behaviour Driven Development
  1. Create a Maven Project in all latest version of eclipse, maven plug in is installed so that option is found.
BDD Behaviour Driven Development
BDD Behaviour Driven Development

Give the group Id and artefact id and click finish

BDD Behaviour Driven Development

Finally the project is created

BDD Behaviour Driven Development

We have feature file and we have project structure:

BDD Behaviour Driven Development

We have pom.xml where maven dependencies are installed and selenium java dependencies have to be added

BDD Behaviour Driven Development

Selenium java dependencies from internet.

Now create a feature file and add scenario. Goto features folder.

Click new then select file give file name to test login

BDD Behaviour Driven Development

Write the scenarios and arrange in pretty format

3. Run the feature file

Create the test runner file then write the code. If we run the testrunner class then we can see the output as scenario got passed. By creating the testrunner class we can run the feature files as per our requirement whatever features we want along with reporting, we can add and test it.

Association of BDD with Agile:

The Behaviour Driven Development is a way of writing the proper requirements which can be automatically turned into code for agile developers to automate testing that feature.

The agile requirements:

User stories became more and more famous tool to write requirements. The standard format of user stories is as below:

As a[user role]

I want [some action]

So [goal]

Quite often user stories look like

As a user

Want to login into application

So I will be logged in

These user stories for simple requirements as authentication is waste of time and also shows the most common mistake which was observed in many teams starting adventure with BDD or Agile requirements.

How to write a good user story using 3 components? 

  1. Who requires it? What is required? and Why is it required? these questions provide context for the user story
  1. Acceptance criteria, this specifies the required functionality for the particular user story
  1. Supporting models, these are supporting documents for analysis models.

For example,

Here, Jack is a BA working with a client running a Restaurant called “Meals on Wheels”. They need a mobile app which has a feature for customers to book a table. Here we have to write a proper user story which involves features like:

  • Register
  • Login
  • Table booking
  • Confirmation message once booking is confirmed in the system
  • Display only available time slots to customer.
Facebook Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button

Get Python Course
worth 499$ for FREE!

Offer valid for 1st 20 seats only, Hurry up!!

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

H2kinfosys Blog will use the information you provide on this form to be in touch with you and to provide updates and marketing.