Cucumber is a collaboration tool that supports BDD (Behavior Driven Development). Cucumber has the ability to read executable specifications written in plain text and its primary focus is to validate whether the software conforms to the specifications or not.

What is BDD?

BDD or Behavior-Driven Development is a software development methodology that aims to narrow the communication gaps between the key stakeholders (e.g. Product owners, Business Analysts, Users, Domain Experts, Developers, UX Designers, Testers, Operation engineers and other team members) while developing a software and focuses on better understanding of the customer requirement and continuous communication with real world examples.

BDD is a process of approaching the design, forcing us to think about the desired outcome and API before coding starts.

Cucumber in BDD

One thing to keep in mind is that Cucumber is primarily not a testing tool. It is a tool for the overall development approach of a software. Automated Tests using Cucumber is one of the many things that Cucumber facilitates.

For automated tests, in order to understand the scenarios, Cucumber must follow some basic syntax rules called Gherkin, which makes plain text structured enough for Cucumber to understand. The Gherkin documents are stored in .feature text files. Example of a cucumber test scenario in Gherkin is as follows:

Scenario: Webpage Subscribe button Validation for unsubscribed customers
	Given the user opens the webpage
	When the user is an unsubscribed customer
	Then the user should be able to view the enabled subscribe button

More about Gherkin and Features later in the tutorial.

Cucumber Compatibility With Other Automation Tools

Cucumber is a not a Browser/API automation tool, but it works well with the following Browser automation tools:

  • Selenium WebDriver
  • Serenity BDD
  • Watir
  • Capybara

And with the following API automation tools:

  • RestAssured
  • Karate DSL
  • RestClient
  • HTTPParty
  • Net::HTTP
  • Faraday
  • RubyMine
  • Curb
  • Typhoeus