Skip to content

Somatori/api_taf_python_pytest_playwright

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api_taf_python_pytest_playwright

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

Quick start

  1. Create & activate virtual environment (macOS / zsh):
python3 -m venv .venv
source .venv/bin/activate
  1. Upgrade pip and install dependencies:
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
  1. Copy .env.template to .env and 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
  1. Create the reports folder if it does not exist:
mkdir -p reports

Reporting (html)

This 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).

How reporting is configured

  • pytest.ini includes an addopts line that runs pytest with --html=reports/report.html --self-contained-html so a report is produced automatically whenever you run pytest.
  • You can disable the automatic generation by removing the addopts from pytest.ini and instead run pytest with the --html option 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

About

The initial API test automation framework (Python / Pytest / Playwright)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages