BDD with Python (Cucumber/Gherkin for Python)

Learn to write BDD style test automation with Python and Behave!!
4.4 (20 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
626 students enrolled
Instructed by Admas Kinfu IT & Software / Other
Take This Course
  • Lectures 34
  • Length 4 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 7/2016 English

Course Description

Course Description

Learn how BDD (Behavioral Driven Development/Test Driven Development) testing frameworks work. Learn how the pieces fall together and how frameworks are put together, as well as best practices of BDD. We will use the most popular and actively maintained 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.

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 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 a 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?

  • 35 + lectures (continuously adding more examples)
  • Plenty of test cases to use in your portfolio and to build bigger test suits on top of
  • Enough material and examples to be able to create a project and maintain a GitHub repo
  • Specific features of the most popular BDD framework for Python called Behave

What are the requirements?

  • Understand basic Python
  • Understand what Automated testing is

What am I going to get from this course?

  • Understand what BDD style testing is
  • Be able to write automated BDD tests using Python
  • Set up BDD testing framework

Who is the target audience?

  • Anyone looking to learn automation testing and has a bit of background in Python
  • Anyone that already know basic automated testing and want to know how to apply BDD
  • Student with no exposure to Python should not take this course

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Introduction
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.

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


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

Section 2: Installations

This section I will demo on how to install Python on your system. If you already have Python installed on your system you can skip this section.


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.


In this lecture I will demo how to install PIP. PIP is tool for Python that enables us install packages very easily. Check if you have pip already installed on your system by typing ‘pip’ in the command line.  If you get some options listed then you have pip. You can skip this section if you already have PIP installed.


In this lecture I will demo installing Behave and Selenium. We will use ‘pip’ which we have installed in previous lecture. Behave is the BDD framework we will use in this course and Selenium WebDriver is the front-end test automation tool we will use in this course. If you do not have both of these packages installed view this lecture or just install them.

Section 3: BDD Components and Basic Examples

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.


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.


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.


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


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.


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


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.


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


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.


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

Section 4: Passing Parameters to Steps

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, ….


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

Section 5: Sharing Data Between Steps

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.


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

Section 6: Time for Practical Examples

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


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


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


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


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.


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.

Section 7: Setup and Teardown

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.

Section 8: Scenario Outlines
Scenario Outline (discussion)
Scenario Outline (demo)
Section 9: Using Tags
Using Tags (discussion)
Using Tags (demo)
Section 10: Conclusion

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Admas Kinfu, QA Automation Engineer

With 7+ years of overall engineering experience I have found my passion in software testing automation and Python has become my favorite tool to work with. I graduated with a MS degree in Mechanical Engineering from San Jose State University, and got into the IT field of software testing automation after graduation. I love to teach and learn as well. I hope to help students grow fast and advance in the field of software testing and automation.

Ready to start learning?
Take This Course