Framework Mode - Marker registration
Folder Structure
test_project/
├── tests/
│ ├── test_login.py
│ ├── test_registration.py
│ └── test_payment.py
├── pytest.ini
├── conftest.py
└── utils/
└── helpers.py
test_project/
├── tests/
│ ├── test_login.py
│ ├── test_registration.py
│ └── test_payment.py
├── pytest.ini
├── conftest.py
└── utils/
└── helpers.py
tests/ folder, contain test functions using pytest markers to categorize tests.pytest.ini file registers custom markers and sets pytest options.conftest.py defines fixtures and hooks used across tests.utils/ folder.The pytest.ini file is used to register custom markers to avoid warnings and enable marker-based test selection.
[pytest]
markers =
smoke: mark a test as a smoke test
regression: mark a test as a regression test
slow: mark a test as slow running
Use command line options to run tests by marker, e.g., pytest -m smoke.
conftest.py can define fixtures that tests with markers can use.
--junitxml=report.xml to generate XML reports for CI tools.smoke tests on pull requests.pytest.ini to avoid warnings and improve clarity.smoke, regression, slow).Where in this folder structure would you add a new marker called api to categorize API tests?