A modular API automation framework built with Python, PyTest, and Requests, featuring reusable client architecture, centralized validation, parametrized testing, and environment-driven configuration for REST API validation.
This framework currently validates public REST APIs from:
https://jsonplaceholder.typicode.com
- Python 3.x
- PyTest
- Requests
- Virtual Environment (venv)
- Git / GitHub
api-automation-framework/
│
├── config/
│ └── config.py
│
├── clients/
│ └── api_client.py
│
├── utils/
│ └── validators.py
│
├── tests/
│ ├── test_users.py
│ ├── test_crud_flow.py
│ └── test_negative.py
│
├── conftest.py
├── pytest.ini
├── requirements.txt
├── README.md
└── .gitignore
- Reusable API client using
requests.Session - Centralized environment configuration
- Parametrized test execution
- Smoke test tagging
- Positive and negative test coverage
- CRUD flow validation
- Centralized response validation utilities
- Clean separation of concerns
The framework currently validates:
- GET multiple users
- GET single user (parametrized)
- Create resource (POST)
- Negative endpoint validation (404 handling)
python -m venv venv
Windows:
venv\Scripts\activate
Mac/Linux:
source venv/bin/activate
pip install -r requirements.txt
Run all tests:
pytest
Run verbose:
pytest -v
Run only smoke tests:
pytest -m smoke
The base URL can be overridden using an environment variable.
Windows:
set API_BASE_URL=https://your-api-url.com
pytest
Mac/Linux:
export API_BASE_URL=https://your-api-url.com
pytest
If not set, the framework defaults to:
https://jsonplaceholder.typicode.com