Cucumber BDD with Python Behave and Selenium WebDriver
4.3 (451 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
14,948 students enrolled

Cucumber BDD with Python Behave and Selenium WebDriver

Build Automation Framework with Cucumber BDD using Python and Behave for Selenium WebDriver and API Testing on Demo Site
4.3 (451 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
14,948 students enrolled
Created by Admas Kinfu
Last updated 5/2020
Current price: $139.99 Original price: $199.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 15.5 hours on-demand video
  • 2 articles
  • 14 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • You will be able to create Cucumber BDD testing framework using Python, Behave, Selenium WebDriver, ....
  • You will be able to read and write Cucumber BDD style tests in Python
  • You will be able to work on Cucumber BDD Framework supporting both Frontend with BDD Selenium and Backend with pure BDD Python
  • You will create full E-Commerce site on your computer and practice test automation
  • You will learn tips and tricks of finding elements, debugging issues, shortcuts with IDE, test methodologies, setup py file
  • You will be able to use virtual environment and try different versions of Python libraries
  • Understand basic Python (Python 3 or 2 is fine)
  • Understand Automated testing basics
  • Have access to install libraries on the computer you are going to use

Course Description

Learn how Cucumber BDD (Behavioral Driven Development/Test Driven Development) testing frameworks work. Learn how the pieces of Cucumber fall together and how frameworks are put together, as well as best practices of BDD. We will use the most popular and actively maintained Cucumber framework for Python BDD called 'Behave'. We will use PowerPoint presentation to convey the concepts on each topic and then write example code testing real scenarios with Selenium WebDriver as well as API testing.

We will build an E-commerce site on our local machine and practice writing real test cases both for front end with Selenium WebDriver and for the backend with Python, with full access to MySQL database of our site.

Critical addition to your resume

If you are getting into the QA world or you are looking to advance your career, having BDD testing skill will accelerate your success. Python is one of the most popular languages to use in software testing, and knowing how to use it with BDD style testing will expand your pool of possibilities.

In addition to using Python for BDD testing you will also get tips and guidance on best practices.   

After completion of this course you will be able to go through interview as if you have BDD testing experience. You will also have a ready to go framework that you can continue to add test cases for practice and for your portfolio.

Content and Overview   

In this course we will be using PowerPoint presentation to explain the concepts and then go to code in an IDE (PyCharm) for each topic. Some topics, we will go directly to code and start writing and executing.   

We will install necessary packages for our framework. We will discuss the directory structure needed for our design, and then we will write and run test cases.  

We will run how the BDD tests are written, how the work together and how to understand and control the output.  

We will create an efficiently structured test framework and learn how to use Pythons logging module to produce readable reports.   

What am I going to get from this course?  

  • 49 + lectures of BDD core concepts, examples and practice exercises (continuously adding more examples) 

  • Plenty of test cases to use in your portfolio and to build bigger test suits on top of the course material

  • Enough material and examples to be able to create a project (BDD test framework) and maintain a GitHub repo 

  • Specific features of the most popular BDD framework for Python called Behave

  • Practice using Selenium WebDriver functions with Python

  • Practice testing of Front-end with Selenium WebDriver BDD and Python

  • Practice testing of Back-end with Python

Who this course is for:
  • Anyone looking to learn automation testing and has a bit of background in Python and Selenium WebDriver
  • Anyone that already know basic automated testing and want to know how to apply BDD
  • Anyone coming from Java or other background and can pickup Python easily
Course content
Expand all 107 lectures 15:15:57
+ Introduction
3 lectures 11:05
Introduction of the course. I will talk about what this course is about, whom it is for and what you expect to get out of it.
Preview 03:34

In this video I will go over the sections of the course and give a quick overview of each.

Preview 02:43

Sections introduce what BDD style is, what the Gherkin scripting language is and what ‘Behave’ framework is.

Preview 04:48
+ Installations
9 lectures 53:33
Installing Python - Mac
Installing Python - Windows
Creating virtual environment on Mac (demo)
Creating virtual environment on Windows (demo)

This section I will demo on how to install PyCharm. Which is an IDE for Python. You are free to use any IDE or text editor you prefer. If you already have an editor you like to use, then you can skip this section. Some options other than PyCharm are Notepad++ and Sublime.

Installing Pycharm / IDE

We see how to enable PyCharm to use a virtual environment for our project. It will have access to installed libraries like Selenium and Behave.

Add Virtual Environment to PyCharm
Add Gherkin Plugin to PyCharm
Installing Behave and Selenium
+ BDD Components and Basic Examples
12 lectures 01:06:19

We will look at a basic directory structure. How to set up our files so that behave will be able to find the test sand run them. We will use PowerPoint slides and discuss the concept.

Folder structure or layout (Discussion)

We will look at creating the structure of our test framework. We will create folders that we will be using for the rest of the course. We will add more folders as needed throughout the course but here we will start with the bare minimum.

Folder structure or layout (Demo/Example)

In this lecture we will get introduced to Feature files. Feature files are one of the major components of BDD style. We will discuss what Feature files look like, what they contain and what they are used for.

Preview 06:09

In this lecture we will get introduced to Steps directory and step definitions. Step directory and step definition files are the second critical components of BDD style. We will discuss what the steps directory is, why we need it, and how it is related to Feature files

Preview 06:56

This section discusses how to run a single feature file. A feature file tests one feature of an application. There may be multiple feature files in a directory. Behave have option of running all or just one file.

Running 1 file (discussion)

This section demo running of single feature time at a time. We will use the command line tool and run feature files.

Running 1 file (demo)

This section discusses on how to run all feature files in a directory or sub-directory. We have seen how we can run a single feature file and now we see how to run all feature files.

Running all files (discussion)

This section demos running of all feature files in a directory and subcategories. We will use the command line tool to demo.

Running all files (demo)
Review Please!

Discussion and demo off outputting information from the test to stdout. Behave offers few options on how the output should be displayed and we will explore on how to do so in this section.

Displaying Output
More on Output

Section to discuss and demo the main keywords we have seen already and additional key works that are “But” and 'And'. 

‘Given’, ‘Then’, ‘When’, ‘And’, ‘But’
+ Passing Parameters to Steps
2 lectures 19:43

This section is discussion of how to pass values from the steps to the step definitions. The feature file will have hard coded values which then the value will be used in the Python logic. Example, quantity, name of web element, url, ….

Passing Parameters to Steps (discussion)

This section demos passing values from the feature file to the Python logic.

Preview 11:38
+ Sharing Data Between Steps
2 lectures 13:19

This section is a discussion of how data can be shared between steps. It is important that data generated in one step should be available in the next step. Example, if user is created in first step then the login step should have access to the user information.

Sharing Data Between Steps (discussion)

In this section I will demo sharing of data between steps using running examples.

Sharing Data Between Steps (demo)
+ Time for Practical Examples
6 lectures 01:00:53

This lecture introduces our section of practical examples. Practical examples are when we write real tests that are run against real websites .

Practical Examples Discussion

In this lecture we will see how our project is set up. What our directory structure looks like and what are the bare minimum directories we need for the project

Project Setup Overview

In this lecture we will write and run a test case using BDD for the site.

Test Cases Group 1 Part 1 (

In this lecture we continue to write and run a test case using BDD for the site.

Test Case Group 1 Part 2 (

This lecture covers on how to create our custom config file and why. Config file is used to make maintenance of code a lot easier. Information used in several places can be stored as a config and modifying information will be done only at one location.

Preview 10:52

In this lecture we continue to write another test case for, but this time we will use config file to get a better understanding of why using config files is very efficient.

Test Case Group 3 (more config examples)
+ Setup and Teardown
3 lectures 24:35

We will discuss how to do setup and teardown of our environment using behave. Setup and teardown run before and after each feature, scenario, step or more to prepare information for the test and then to destroy or reset information after the test.

Setup and Teardown (discussion)
+ Scenario Outlines
2 lectures 15:29
Scenario Outline (discussion)
Scenario Outline (demo)
+ Using Tags
2 lectures 17:56
Using Tags (discussion)
Using Tags (demo)
+ Cucumber Behave Report Generation
5 lectures 36:33
Generating Behave Reports Overview
How to Output Junit Compatible xml
How to Output JSON Report
How to Generate Allure Report
How to Generate Custom Report