Page cover image

📑Content

Module 1: Introduction to pytest

  • Introduction to pytest

  • Installing pytest

  • Writing and running a simple pytest test case

  • Using assertions in pytest

  • Organizing tests into test classes and test modules

  • Running tests with pytest

Module 2: Test fixtures

  • Introduction to test fixtures

  • Writing and using setup and teardown functions

  • Using fixture functions to manage test dependencies

  • Parameterizing fixtures

  • Using the pytest fixture registry

Module 3: Markers and Test Selection

  • Introduction to markers

  • Marking test functions and test classes

  • Running tests based on markers

  • Using the -k option to run tests that match a keyword expression

  • Selecting tests based on file names, directories, and Python classes

Module 4: Test Parametrization

  • Introduction to test parametrization

  • Parametrizing test functions

  • Parametrizing fixture functions

  • Generating test parameters dynamically

  • Combining multiple parametrized tests

Module 5: Test Coverage and Reporting

  • Introduction to test coverage

  • Using pytest-cov to measure test coverage

  • Integrating test coverage with continuous integration

  • Introduction to test reporting

  • Using pytest-html to generate test reports

Module 6: Advanced Topics

  • Advanced fixture features (e.g., scopes, autouse fixtures)

  • Working with databases and web services

  • Mocking and patching in pytest

  • Writing plugins and extending pytest

  • Best practices for pytest development

Last updated