Skip to content

Oksuzova/pytest_bdd_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

behavior-driven-python/pytest-bdd

Purpose

This project shows how to do [BDD] in [Python] using pytest-bdd, a plugin for the pytest test automation framework and Allure framework for generating tests reports. It exhibits the basics of pytest-bdd with simple unit- and simple e2e- tests. Tests are meant to highlight pytest-bdd features, not to necessarily show testing best practices for scalable solutions.

Setup

This project uses Python 3. Use venv to create a virtual environments for dependencies. Use allure to create test reports.

Features

There is 1 feature files that showcase how to use pytest-bdd in various ways:

  1. book_manager.feature
    • Contains e2e test scenarios for a bookshelf project.
    • Tests that book can be added and removed from closet.
    • Tests that new book added as unread status to closet.
    • Tests for reading books.

Test Execution

To run all tests from the root directory, run pytest. All the standard pytest command line options work. Use command line options for filtering and other controls. Options may also be put inside the pytest.ini configuration file. Below are some common options:

# run all tests
pytest

# to understanding that markers can be use
pytest --markers


# filter tests by tags
pytest -m "e2e" 
pytest -m "unit"      

# print Allure report
# Replace allure-results with the path to the directory specified in the outputFolder setting of the reporter
allure serve allure-results

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors