Cucumber – Behavior Driven Development

felix Sep 12, 2022 | 564 Views
  • Computer Software

Share with:


In order to get better advantage of the software testing, organizations are nowadays taking a step forward. They implement important acceptance test scenarios while development is in-progress. This approach is commonly known as Behavior Driven Development (BDD).

Behavior Driven Development gives us an opportunity to create test scripts from both the developer’s and the customer’s perspective as well. So in the beginning, developers, project managers, QAs, user acceptance testers and the product owner (stockholder), all get together and brainstorm about which test scenarios should be passed in order to call this software/application successful. This way they come up with a set of test scenarios. All these test scripts are in simple English language, so it serves the purpose of documentation also.

 

Example

If we are developing a user authentication feature, then the following can be few key test scenarios, which needs to get passed in order to call it a success.

  • The user should be able to login with correct username and correct password.
  • The user should not be able to login with incorrect username and correct password.
  • The user should not be able to login with correct username and incorrect password.

 

How it Works

By the time the code is ready, test scripts are ready too. The code has to pass the test scripts defined in BDD. If it does not happen, code refactoring will be needed. Code gets freezed only after successful execution of defined test scripts.

BDD

It is a very simple notion, but what we need in order to get this concept implemented. The answer is, Behavior Driven Development (BDD) Framework. Cucumber is one such open source tool, which supports behavior driven development. To be more precise, Cucumber can be defined as a testing framework, driven by plain English text. It serves as documentation, automated tests, and a development aid – all in one.

So what does Cucumber do? It can be described in the following steps −

Cucumber reads the code written in plain English text (Language Gherkin – to be introduced later in this tutorial) in the feature file (to be introduced later).

It finds the exact match of each step in the step definition (a code file – details provided later in the tutorial).

The piece of code to be executed can be different software frameworks like Selenium, Ruby on Rails, etc. Not every BDD framework tool supports every tool.

This has become the reason for Cucumber’s popularity over other frameworks, like JBehave, JDave, Easyb, etc.

Cucumber supports over a dozen different software platforms like −

  • Ruby on Rails
  • Selenium
  • PicoContainer
  • Spring Framework
  • Watir

Comments (1 Comment)

Leave a Reply

Your email address will not be published.

Rince P Sep 12th, 2022
Nice article

Top Brands

People with similar interest

AB33 is a Trusted Online Casino Malaysia that offers a wide range of exciting games and the opportunity to play with real money. AB33's online casino Malaysia real money games include popular options such as slots, blackjack, roulette, poker, and more. The platform has a dedicated support team available 24/7 to assist with any inquiries or concerns. AB33 provides an immersive and rewarding online casino experience for players seeking the thrill of gambling with real money. https://ab33malaysia.com/
View Profile
Witan Search

I am looking for

Witan Search