Skip to content

Test Automation University: Behavior-Driven Python with pytest-bdd Example Code

License

Notifications You must be signed in to change notification settings

jgh2i/tau-pytest-bdd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tau-pytest-bdd

This repository contains example code for the Behavior-Driven Python with pytest-bdd course from Test Automation University. There is a branch for each chapter of the course showing the state of the code at the completion of the chapter.

Version 4 Warning

The TAU course was developed with pytest-bdd version 3. Unfortunately, the version 4 update has incompatible changes. @given methods must now include a target_fixture parameter in order to work like pytest fixtures. The TAU videos and transcripts use the old style of code, but the example code here now uses the new style of code. Below is an example of the new style of code needed:

@given("the basket has 2 cucumbers", target_fixture='basket')
def basket():
    return CucumberBasket(initial_count=2)

Setup

This project requires an up-to-date version of Python 3. It also uses pipenv to manage packages.

To set up this project on your local machine:

  1. Clone it from this GitHub repository.
  2. Run pipenv install from the command line in the project's root directory.
  3. For Web UI tests, install the appropriate browser and WebDriver executable.

Running Tests

Run tests simply using the pytest command. Depending upon your environment, it may be better to use python -m pytest. If you are using pipenv, then run pipenv run python -m pytest. Use the "-k" option to filter tests by tags.

More Info

For the best experience, take the full TAU course chapter-by-chapter. Check out the branch for each chapter and follow along.

About

Test Automation University: Behavior-Driven Python with pytest-bdd Example Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 71.2%
  • Gherkin 28.8%