- Python 3.11 or higher
- pip (Python package installer)
- Git
git clone <repository-url>
cd python-api-automation
pip install -r requirements.txt
pytest
pytest tests/test_get_books.py
pytest tests/test_get_books.py::test_get_all_books
# Runs only regression tests
pytest -m regression
pytest --html=reports/custom-report.html
# Open the latest report
start reports/report-*.html # Windows
open reports/report-*.html # macOS
xdg-open reports/report-*.html # Linux
The project uses environment.json
for configuration, it contains:
{
"base_url": "https://fakerestapi.azurewebsites.net/api/v1"
}
Test data is stored in the data/
directory:
book_data.json
- Valid book databook_data_nullable.json
- Data with nullable fieldsbook_data_invalid_date.json
- Invalid date formatbook_data_extra_property.json
- Data with extra propertiesbook_data_update.json
- Data for update operations
- TC1: Schema validation for all books
- TC2: Basic GET all books
- TC3: Unsupported method (OPTIONS)
- TC4: Get specific book by ID
- TC5: Get non-existing book (404)
- TC6: Create book with valid data
- TC7: Create book with nullable fields
- TC8: Create book with no body (400)
- TC9: Create book with invalid date (400)
- TC10: Create book with extra properties (400)
- TC11: Update existing book
- TC12: Update with invalid data (400)
- TC13: Delete existing book
- TC14: Delete invalid book ID (400)
- TC15: Delete with long ID (400)
- Trigger: Push to main branch
- Environment: Ubuntu latest with Python 3.11
- Reports: HTML test reports uploaded as artifacts
- Status: Continues on test failures for reporting purpouses