BDD with Cucumber JavaScript and Selenium WebDriver

Behaviour-Driven Development (BDD) has become a well established approach to testing, providing ‘living documentation’ of the system under test, and being able to use the documentation to drive the test automation. Our BDD courses teach you what BDD is all about, how to write your Gherkin Feature files, and then how to bind the test automation code to the features. To learn more about BDD visit this page.

The perfect introductory course on Behaviour-Driven Development. This course covers writing Feature Files in Gherkin, then generating Step Definitions and then writing the code bindings using Selenium WebDriver JavaScript. This course uses Cucumber-JS, and Selenium WebDriver JavaScript all in Microsoft’s Visual Code. The course prerequisite is that you have done some WebDriver or sat on our 3 day WebDriver JS course.

Course Delivery

The course is delivered online. It is live, instructor-led training over 3 days. Each day is an online session of approx. 3.5 hours. All delegates receive a comprehensive workbook, and the sessions are recorded. It can be accessed from anywhere in the world. We also offer on-site training at your offices if required.

Technologies Used

The course uses: Microsoft Visual Studio Code (our IDE), cucumber-js (BDD framework), Selenium WebDriver JavaScript (automation tool), Chai (Assertion Library), NodeJS (JavaScript platform), NPM

Course Overview

Introduction to BDD

A background to BDD and its benefits. The process of BDD. An overview of the tools available, terminology.

Introduction to Gherkin

Feature Files, introduction to the Gherkin language, basic syntax

More Gherkin

Using the Background fixture, Parameters, Doc Strings, Examples and Data Tables, using Tags to organise execution, commenting

Installation of the Cucumber Framework

Installing Cucumber with npm. Creating a project structure, creating a Feature, execution of Feature Files

Step Definitions & Code Binding

Using prototype step definitions, creating step definition Methods, expanding Methods with Parameters, Step Definition syntax, using Regular Expressions

Running the Cucumber Tests

Using Cucumber Command Line Interface, CLI parameters, Results & Reporting, HTML reports


Using Hooks in cucumber-js (BeforeAll, Before, After, AfterAll), Cucumber Timeouts

The Cucumber World Object

Attaching items to World, Creating your own custom World Constructor

Tables & Scenario Outlines

In-line Step Table Iterating, Scenario Outline Data Handling

Integrating Cucumber into the POM

Using Cucumber & WebDriver under the Page Object Model. Using Helpers

VS Code Tips

Cucumber Icon Packs, Setting up GoTo Definitions Shortcut, Debugging scripts