Automated API test suite for the Open Library API, built with Python and pytest.
Endpoints covered in the tests:
Search (/search.json)
- Results returned for title and author queries
- Empty query handling
- Schema validation (title, author_name, first_publish_year field types)
- Content-Type header
- Response time < 5s
Books (/works/{id}.json)
- 200 for valid IDs, 404 for invalid
- Required field: title is a non-empty string
- Optional field: description presence
- Content-Type header
Authors (/authors/{id}.json)
- 200 for valid IDs, 404 for invalid
- Required field: name is a non-empty string
- Optional field: birth_date presence
- Content-Type header
smoke— fast sanity checks for critical pathsschema— field type and structure validationslow— network-sensitive tests (response time)
- Python 3
- pytest
- requests
- pytest-html for reporting
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt# All tests
pytest -v
# Smoke only
pytest -v -m smoke
# Schema only
pytest -v -m schema
# Skip slow tests
pytest -v -m "not slow"
# HTML report
pytest -v --html=report.html --self-contained-html