Cucumber is a tool that supports Behavioral Driven Development (BDD). It lets the user define an application's behavior in plain English language which makes it easier for non-programmers to understand the application flow. In this article, we will take a look at how to create your first cucumber script.
We will use Eclipse IDE and Java programming language in our example. You can download the latest Eclipse IDE from here. Make sure you download the "Eclipse IDE for Java Developers" package.
Cucumber is a tool based on Behavior Driven Development (BDD) framework which is used to write acceptance tests for the web application. It allows automation of functional validation in an easily readable and understandable format (like plain English) to Business Analysts Developers Testers etc.
In order to create your first cucumber script you need the following two things:
• Feature File: This is an entry point to cucumber tests. All cucumber tests are written in a feature file with the ".feature" extension. In simple terms, a feature file is nothing but a test script written in plain English language which describes the behavior of an application without going into its details.
• Step Definition File: This is a glue code between the feature file and the actual system under test. In order to bind them together, we need step definition files that contain the actual implementation of features written in the feature file.
In order to improve my cooking skills
As a hungry person
I want to be able to follow recipes
The second step is to write step definitions for each of the steps in the feature. A step definition is a small piece of code that tells Cucumber what code to execute when it sees a particular step in a scenario.