Introduction to Cucumber & BDD

What is Cucumber ?

Cucumber is a framework which supports the implementation of BDD in Selenium Automation by doing the below:

  • Allows us to create Feature Files in plain English language.
  • Understands the Gherkin language which is used for writing the scenarios inside Feature Files in plain English language.
  • Connects the steps inside the Feature Files with the automation code written in Selenium Java language and executes.
Advantages of Cucumber ?
  • It is helpful to involve business stakeholders in to the project who can’t easily read code, So we can avoid lag of communication gap.
  • Cucumber Testing focuses on end-user experience.
  • Style of writing tests allow for easier reuse of code in the tests
  • Quick and easy set up and execution
What is BDD ?
  • BDD stands for Behavior Driven Development.
  • In traditional development projects, there will be a communication gap between Customers,Developers & Testers.
  • Developers misunderstand the Business requirements provided by Customers and build wrong products. BDD can be used to overcome this problem
Developers misunderstand the Business requirements provided by Customers and build wrong products.
  • In BDD, development is driven by the behavior of the required Software. Here Development focuses on what to be developed instead of how to develop.
  • Behavior of the required Software will be communicated in a plain English language using which the Business, Developers and Tester will be on the same page.
  • Example (Amazon.com) -See below image to find out how the behavior of the software can be communicated in a plain English language.
What is TDD ?
  • TDD stands for Test Driven Development.
  • In TDD, the test is written to check the implementation of functionality, but as the developer’s prospective, tests can give false results.
TDDBDD
The process starts by writing a test case.The process starts by writing a scenario as per the expected behavior.
TDD focuses on how the functionality is implemented.BDD focuses on the behavior of an application for the end user.
Test cases are written in a programming language.Scenarios are more readable when compared to TDD as they are written in simple English format.
Collaboration is required only between the developers.Collaboration is required between all the stakeholders.
Might be a better approach for projects which involve API and third-party tools.Might be a better approach for projects which are driven by user actions. For e.g. e-commerce website, application system, etc.
Tests in TDD can only be understood by people with programming knowledge.Tests in BDD can be understood by any person including the ones without any programming knowledge.

Next

Leave a comment

Design a site like this with WordPress.com
Get started