Framework Mode - Why markers categorize and control tests
Folder Structure of a Pytest Project Using Markers
tests/ ├── test_login.py ├── test_shopping_cart.py ├── test_checkout.py ├── conftest.py └── pytest.ini
tests/ ├── test_login.py ├── test_shopping_cart.py ├── test_checkout.py ├── conftest.py └── pytest.ini
tests/ folder, e.g., test_login.py. Markers categorize tests by feature or type.conftest.py to prepare test environments.@pytest.mark.smoke.pytest.ini.Markers must be declared in pytest.ini or markers.ini to avoid warnings and to document their purpose.
# pytest.ini
[pytest]
markers =
smoke: quick tests to check basic functionality
regression: full tests for all features
login: tests related to login functionality
Run tests by marker using command line options:
pytest -m smoke pytest -m "not regression"
Use environment variables or config files to control which markers run in different environments.
pytest-html or pytest-junitxml to generate readable reports including marker info.pytest.ini with descriptions.Where in this framework structure would you add a new marker for tests related to the "payment" feature?