The initial API test automation framework (Python / Pytest / Playwright).
It can be used as a standalone project or integrated into a web UI test automation framework (for example, this one: https://github.com/Somatori/web_taf_python_pytest_playwright).
The app under test: https://thinking-tester-contact-list.herokuapp.com/
The API documentation: https://documenter.getpostman.com/view/4012288/TzK2bEa8
- Create & activate virtual environment (macOS / zsh):
python3 -m venv .venv
source .venv/bin/activate- Upgrade pip and install dependencies:
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt- Copy
.env.templateto.envand fill required values (especially if you want authenticated tests):
cp .env.template .env
# edit .env to include API_BASE_URL, TEST_USER_EMAIL, TEST_USER_PASS as needed- Create the reports folder if it does not exist:
mkdir -p reportsThis project uses pytest-html to produce a single-file HTML report after each pytest run. The generated report is placed in the reports/ directory (default reports/report.html).
pytest.iniincludes anaddoptsline that runs pytest with--html=reports/report.html --self-contained-htmlso a report is produced automatically whenever you runpytest.- You can disable the automatic generation by removing the
addoptsfrompytest.iniand instead run pytest with the--htmloption manually when you want a report.
Notes:
- This repo uses Playwright's APIRequestContext (sync API) for HTTP calls.
- Browser engines are not required for API-only tests. If you later add web tests, run: playwright install