A comprehensive API testing framework using Python, pytest, and the Requests library.
This project provides automated tests for various REST APIs including:
- Fakerest API - Activity management endpoints
- GoRest API - User authentication and data operations
- Bookings API - Hotel booking management
- ReqRes API - User creation and update operations
- Python - Programming language
- pytest - Testing framework
- requests - HTTP library for API calls
API_Test_Automation_Python/
├── python_api_testing/ # Main API test implementations
│ ├── faker_rest_api_collection/
│ ├── go_rest_api_collection/
│ ├── bookings_api_collection/
│ └── reqres_api_collection/
├── tests/ # Test files
├── postman/ # Postman collections for reference
├── utils/ # Utility functions
├── conftest.py # pytest configuration
├── pytest.ini # pytest settings
└── requirements.txt # Python dependencies
- Python 3.7+
- pip
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows:
venv\Scripts\activate - Unix/MacOS:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
Run all tests:
pytestRun specific test file:
pytest tests/test_get_activities.pyRun with HTML report:
pytest --html=reports/report.htmlTest configuration is in pytest.ini:
- Max failures before stopping: 2
- Verbose output enabled
- HTML report generation
Test reports are automatically generated locally and uploaded to GitHub Actions during every pipeline run.
Locally executed test reports are written directly into the reports/ directory with explicit execution timestamps:
- Path:
reports/reports_<timestamp>.html
Every time the automated CI/CD suite triggers on a push or a pull request, the test report is bundled up as a downloadable build artifact:
- Navigate to the Actions tab in the repository.
- Click on the most recent completed workflow run (marked with a green checkmark).
- Scroll down to the absolute bottom of the run summary page to the Artifacts block.
- Click on the
pytest-reportarchive link to download the zip file containing your execution logs and interactive HTML summary.
MIT License