This project uses Playwright with Pytest-BDD for automated API testing. It supports structured execution, fixtures, markers, parallel testing, and generates reports for further investigation.
Install all dependencies:
pip install pytest
pip install pytest-playwright
pip install pytest-xdist
playwright installTo generate requirements.txt with all installed dependencies, use:
pip freeze > requirements.txtThis command will create a requirements.txt file with all the necessary packages.
| Action | Command |
|---|---|
| Run all tests | pytest -s |
| Run a specific file | pytest tests/test_login.py |
| Run by test method name | pytest -k "partial_method_name" |
| Run tests with marker (e.g., smoke) | pytest -m smoke -v |
| Run in headed mode (for UI, if needed) | pytest tests/test_file.py::test_case --headed |
| Run tests in parallel | pytest -n 4 |
Markers help organize and filter tests.
@pytest.mark.skip # Skip a test.
@pytest.mark.smoke # Tag a test as part of smoke suite.
@pytest.mark.regression # Tag a test as part of regression suite.Run with:
pytest -m smoke -vTo speed up test execution using multiple CPUs:
pytest -n 4Make sure pytest-xdist is installed.
project_root/
├── features/
│ ├── login.feature
│ └── order.feature
├── steps/
│ ├── test_login.py
│ └── test_order.py
├── data/
│ └── credentials.json
├── config/
│ └── config.json
├── conftest.py
├── requirements.txt
└── README.md
Happy Testing! 🚀