Cucumber
Gherkin Language: Format, Syntax & Gherkin Test in Cucumber
What is Gherkin Language? Gherkin is a business readable language which helps you to describe...
For every cucumber project there is a single directory at the root of the project named "features". This is where all of your cucumber features will reside. In this directory you will find additional directories, which is step_definition and support directories
Features file contain high level description of the Test Scenario in simple language. It is known as Gherkin. Gherkin is a plain English text language
Feature File consist of following components -
Sample Feature File Example:
Feature: Visit career guide page in career.gtupapers.com Scenario: Visit career.gtupapers.com Given: I am on career.gtupapers.com When: I click on career guide menu Then: I should see career guide page
Step definition maps the Test Case Steps in the feature files(introduced by Given/When/Then) to code. It which executes the steps on Application Under Test and checks the outcomes against expected results. For a step definition to be executed, it must match the given component in a feature. Step definition is defined in ruby files under "features/step_definitions/*_steps.rb".
Example for Step Definition: Here we will above example of browsing career.gtupapers.com do We will use features like "When, Then, Given "
Step 1: Given (/^ I am on career.gtupapers.com$/) do Browser.goto "http://career.gtupapers.com" -This will visit career.gtupapers on browser end Step 2: When (/^ click on career guide menu$/) do Browser.text (:name, " career guide" ).click – This will click "career guide menu" end Step 3: Then (/^ I should see career guide page$/) do Browser.goto "http://career.gtupapers.com/category/career-guide/" - It will visit "career guide page" end
Summary:
What is Gherkin Language? Gherkin is a business readable language which helps you to describe...
What is Cucumber? Cucumber is a testing tool that supports Behavior Driven Development (BDD). It...
Cucumber installation could be tiresome but its relatively easy. Here is a roadmap of components that need...
In this tutorial, we will create Cucumber Scripts to test two scenarios Cucumber Script 1:...
Training Summary Behavior Driven Development (BDD) is a rising methodology to test and check your...