Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Cucumber with Selenium

Java (BDD Testing)


What is Cucumber

Cucumber is a software tool, and it supports BDD(behavior-driven development).

Cucumber BDD tool is very popular in testing industry, mainly because of the
writing test cases in (High Level)plain ordinary language called Gherkin. It's like
writing test cases in “english language”

It uses the framework annotations to understand software behaviors to be


specified in a logical language which is intelligible to the users.(Specially from
non-coding background)
BDD Approach

“The behavior-driven development” (BDD) is:


an Agile software development process
which inspires a joint effort among developers, QA and non-technical or
business participants in the project.

Framework approach in automation. A framework for test automation, consist of


different modules and libraries.

They simply use the object-oriented approach, to provide us with an integrated


system or environment, where we can write our test case for the specific product.
Cucumber Installation

Here is a guide from where you can follow step by step instruction to integrate
Cucumber framework into your Eclipse IDE

Step-by-Step Instruction

Cucumber Dependencies

Download Jar Files


Gherkin syntax

Gherkin is a line-oriented language that uses indentation to define structure, with


line ending termination.(Also called Steps)
Feature: feature login feature of new website for testing

Scenario: login test for new website

Given I am on the demo website "http://<demo.anywebsite>.com/"

When I type login = "a" and password = "a"

And I click sign-in button

Then I should get "SIGN-OFF" link


Feature File - Gherkin Language

Create a file with extension feature - “search.feature”

Feature: test scenario to test google search page


Scenario: Search with different set of words
Given I am on google page "http://google.com/"
When I type login = "<seachWords>"
And I click on google search button

Goto run as >> run search.feature file


Step Definition File

A step definition is java file responsible for actually working on the feature file. It
can be a Regular Expression or a Cucumber Expression.

The examples in this section use Cucumber Expressions.

Example Code
TestRunner File

A test runner file is responsible for running the JUnit test on your step definition file
including feature file.

Run as >> JUnit Tests

Example Code
Cucumber Combined Practicals Links

Basic Program

https://drive.google.com/file/d/1gQuu2k5E4KJeEdGx5BEMjNhHa_nmo2k4/view?u
sp=sharing

Login Program

https://drive.google.com/file/d/1xHu42P6Ni9PZqxVyyXgPmsU61UVtwxQw/view?u
sp=sharing

Scenario Based Login

https://drive.google.com/file/d/1embC2G_f45w9rIsGAHtwcxDYjRxgd2Wx/view?us
p=sharing

You might also like