This project demonstrates automated API testing using Python, pytest, and the requests library. It tests the ReqRes API endpoints with various test scenarios including positive and negative test cases.
- Python 3.14
- pytest - Testing framework
- requests - HTTP library for API calls
- pytest-html - HTML report generation
QA-Testing/
├── tests/
│ ├── __init__.py
│ └── test_cases/
│ ├── __init__.py
│ └── test_users.py
├── reports/
│ └── test_report.html
├── venv/
├── requirements.txt
└── README.md
git clone <your-repo-url>
cd QA-Testingpython3 -m venv venv
source venv/bin/activate # On Mac/Linux
# OR
venv\Scripts\activate # On Windowspip install -r requirements.txt# Run all tests
pytest tests/test_cases/test_users.py -v
# Run with detailed output
pytest tests/test_cases/test_users.py -v -s
# Generate HTML report
pytest tests/test_cases/test_users.py --html=reports/test_report.html --self-contained-html- Endpoint:
GET /api/users/2 - Validates: Status code 200, user ID, email field
- Endpoint:
GET /api/users?page=2 - Validates: Status code 200, data list not empty, pagination
- Endpoint:
GET /api/users/999 - Validates: Status code 404 for non-existent user
- Endpoint:
POST /api/users - Validates: Status code 201, response fields (name, job, id, createdAt)
- ✅ Automated API testing
- ✅ Positive and negative test scenarios
- ✅ API authentication with headers
- ✅ Detailed HTML test reports
- ✅ Clean, maintainable code structure
- ✅ Comprehensive assertions
This project uses ReqRes API which requires an API key:
HEADERS = {
"x-api-key": "reqres-free-v1"
}All tests passing with 100% success rate. See reports/test_report.html for detailed results.
- Add more test cases (PUT, PATCH, DELETE)
- Implement data-driven testing
- Add API response time validation
- Integrate with CI/CD pipeline
- Add test data management
Simarpal Singh
This project is for educational purposes.