This project provides automated tests for the public API https://reqres.in, built using Python, Pytest, and the Requests library.
📁 project_root/ ├── 📁 data/ │ ├── 📁 json_schemas/ # JSON schema files for response validation │ └── payloads.py # Dynamic payload generators for requests │ ├── 📁 tests/ # Test modules organized by endpoint/functionality │ ├── test_01_list_users.py │ ├── test_02_get_user_details.py │ ├── test_03_get_invalid_user.py │ ├── test_04_create_user.py │ └── test_05_delete_user.py │ ├── 📁 utils/ │ ├── api_client.py # Custom API client class for HTTP methods │ └── schema_loader.py # Helper to load and use JSON schemas │ ├── conftest.py # Global fixtures used across tests ├── pytest.ini # Pytest configuration (e.g., markers) └── requirements.txt # List of project dependencies
- Python 3.13+
- Requests
- Pytest
- Jsonschema
To install all dependencies:
pip install -r requirements.txt
pytest -v
- GET list of users from page 1:
- Validate response status code
- Validate response JSON schema
- Few JSON response assertions
- Extract single user details (Id, Email)
- Sort users by first name and print
- GET single user details:
- Validate response status code
- Validate response JSON schema
- Few JSON response assertions
- GET non-existent user:
- Validate response status code
- Validate empty response body
- POST create new unique user:
- Validate response status code
- Validate response JSON schema
- Few JSON response assertions
- DELETE created user:
- Validate response status code
- Validate empty response body
- Parameterize base URL:
- Move all related code to conftest.py for centralized configuration
- All fixtures are defined in conftest.py and shared across tests
- Randomized test data ensures uniqueness on POST requests
- JSON schema files live in data/json_schemas/
- Project is designed to be scalable and extendable