Introduction to Cucumber | Selenium Integration with Cucumber|

Published: 08 July 2019
on channel: G C Reddy Software Testing
4,351
51

https://www.gcreddy.com/2019/07/selen...
Selenium Integration with Cucumber BDD Tool

1. What is Cucumber?
2. Why Integrating Selenium and Cucumber?
3. Prerequisites for Behavior Driven Development
4. Selenium Integration with Cucumber- Test Environment Setup

1. What is Cucumber?

- Cucumber is an open source tool to support Behavior Driven Development with plain text specifications, It is not an Automated Test Tool and It can Test Functional behavior of web applications using Selenium or Watir etc, Tools.

- Behavior Driven Development (BDD) framework is extended version of TDD (Test Driven Development) that supports behavioral part of software code.

- Cucumber was written in Ruby. Cucumber supports other languages like Java, Net, Javascript and other platforms.

- Cucumber reads executable specifications written in plain text and validates that the software does what those specifications say.

- In order for Cucumber to understand the scenarios, they must follow some basic syntax rules, called Gherkin. Gherkin is a simple set of grammar rules that makes plain text structured enough for Cucumber to understand.

- Cucumber is used to write acceptance tests for web applications, It allows automation of functional validation in easily readable and understandable format (like plain English) to Business Analysts, Developers, Testers, etc.

- In BDD, users (business analysts, product owners) first write scenarios or acceptance tests that describes the behavior of the system from the customer's perspective, for review and sign-off by the product owners before developers write their codes.

Advantages of Cucumber

- It is helpful to involve business stakeholders who can't easily read code

- Cucumber Testing focuses on end-user experience

2. Why Integrating Selenium and Cucumber?

Cucumber and Selenium are two popular technologies.

Most of the organizations use Selenium for functional testing of web applications. these organizations want to integrate Cucumber with Selenium to easy to read and to understand the application flow.

Cucumber tool acts as the bridge among Business Analyst, Software Testers and Software Developers.

Cucumber also benefits the client to understand the application code as it uses Gherkin language which is in Plain Text.

3. Prerequisites for Behavior Driven Development,

BDD Test Tool — to define application behavior in plain meaningful English text using a simple grammar defined by a domain specific language (DSL)– e.g. Cucumber (DSL: Gherkin), JBehave (DSL: Gherkin), Behat (DSL: Gherkin), Mocha (DSL: user-defined)

Test Runner — to automate and run the behavior tests– e.g. TestNG (Java), JUnit (Java) ETC,

Optional IDE plugins — Ex: Cucumber plugin for Eclipse IDEs to enable BDD coding support.

Test Tool - Ex Selenium to write Test Steps for BDD tool like Cucumber Test Specification

Cucumber jar files:

cucumber-core
cucumber-java
cucumber-junit
cucumber-jvm-deps
cucumber-html
gherkin
testng
cucumber-testng
cucumber-picocontainer
extentreports
cucumber-extentsreport
selenium-server
webdrivermanager,

Note: If we use Selenium, Java with Cucumber then you can use either JUnit ot TestNG as Test Runner.

4. Selenium Integration with Cucumber- Environment Setup

Eclipse IDE, Maven, Selenium WebDriver, Java, JUnit or TestNG, Cucumber and ExtentsReport etc, software.

Steps:
- Download & Install Java (JDK) Software
- Set Java Environment Variable path
- Download & Extract Eclipse IDE for Java Developers,
- Install "TestNG" plugin for Eclipse IDE
* If you want to use JUnit as Test Runner you can use, JNiunt is built-in plugin in Eclipse IDE,
- Create Maven Project
- Add the below Maven Software dependecies in Maven POM XML file
cucumber-core,
cucumber-java,
cucumber-junit,
cucumber-jvm-deps,
cucumber-html,
gherkin,
testng,
cucumber-testng,
cucumber-picocontainer,
extentreports,
cucumber-extentsreport,
selenium-server,
webdrivermanager,

- Restart Eclipse IDE
Now Selenium with Cucumber Test Environment is ready.