Automated REST API test suite built with Python, PyTest, and Requests, targeting reqres.in. Covers the authentication token flow, full CRUD operations, JSON schema validation, and negative/edge-case testing. Includes a companion Postman collection for manual and exploratory testing of the same endpoints, and runs automatically on every push via a GitHub Actions CI/CD pipeline.
- Auth token flow — register and login tests, including missing-field and invalid-credential negative cases
- CRUD operations — GET (single + paginated list), POST (create), PUT (update), DELETE, with status code and response body assertions
- JSON schema validation — response structure and data types validated against defined schemas, not just individual field values
- Data-driven testing — login and user-creation scenarios loaded from JSON files and run via
pytest.mark.parametrize, so new test cases can be added without touching code - Negative testing — 404s on non-existent resources, invalid ID formats, malformed requests
- HTML reporting — a self-contained
pytest-htmlreport generated after every run - CI/CD — GitHub Actions pipeline runs the full suite on every push/PR and uploads the HTML report as a build artifact
- Postman collection — the same endpoints available for manual exploration, organized into Auth, CRUD, and Negative Cases folders
| Tool | Purpose |
|---|---|
| Python 3.11 | Language |
| PyTest | Test runner, fixtures, parametrization |
| Requests | HTTP client |
| jsonschema | Response schema validation |
| pytest-html | HTML test reports |
| GitHub Actions | CI/CD pipeline |
| Postman | Manual/exploratory API testing |
api-test-suite-project/
├── tests/
│ ├── test_auth.py # register/login, token validation
│ ├── test_users_crud.py # GET/POST/PUT/DELETE + schema checks
│ └── test_negative.py # 404s, invalid IDs, edge cases
├── utils/
│ ├── api_client.py # requests wrapper (base URL, headers, API key)
│ └── schema_validator.py # JSON schema assertion helper
├── schemas/ # JSON schema definitions
│ ├── user_schema.json
│ └── user_list_schema.json
├── test_data/ # JSON-driven test scenarios
│ ├── login_data.json
│ └── create_user_data.json
├── postman/
│ └── API_Test_Suite.postman_collection.json
├── conftest.py # shared fixtures (api_client, auth_token)
├── pytest.ini # markers + HTML report config
├── requirements.txt
└── .github/workflows/ci.yml # CI pipeline
# Clone the repo
git clone https://github.com/Arunkumar-1809/api-test-suite-python.git
cd api-test-suite-python
# Create and activate a virtual environment
python -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # macOS/Linux
# Install dependencies
pip install -r requirements.txtreqres.in requires a free API key. Sign up at reqres.in/signup, then set it as an environment variable:
setx REQRES_API_KEY "your-key-here" # Windows (restart terminal after)
export REQRES_API_KEY="your-key-here" # macOS/Linuxpytest # run the full suite
pytest -m smoke # smoke tests only
pytest -m auth # auth flow tests only
pytest -m crud # CRUD tests only
pytest -m negative # negative/edge case tests only
pytest -k "TC_LOGIN_01" # run one specific testAn HTML report is generated at reports/report.html after every run.
Every push to main triggers a GitHub Actions workflow that:
- Checks out the code
- Sets up Python 3.11
- Installs dependencies
- Runs the full test suite (using a
REQRES_API_KEYrepository secret) - Uploads the HTML report as a downloadable build artifact
Import postman/API_Test_Suite.postman_collection.json into Postman for manual/exploratory testing of the same endpoints — useful for quick checks without spinning up the automated suite.