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.
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