English | Π ΡΡΡΠΊΠΈΠΉ
Portfolio framework for automated testing of RESTful Booker Platform microservices. Implemented in Python and Pytest using modern practices to improve code readability and structure.
This project was created for educational purposes to practically master the following skills:
- Automated testing of REST APIs in Python
- Working with microservice architecture
- Organizing test code for maintainability
- Integration with CI/CD (GitHub Actions) and reporting systems (Allure)
- Structured code organization: logical separation into API clients, data factories, and utilities
- Response validation: using Pydantic models and JSON Schema to verify data structure
- Test data generation: using the Faker library to create diverse input data
- Detailed reporting: integration with Allure for clear test execution reports
- Automated test runs: configuring CI/CD pipeline in GitHub Actions
- Logging: custom handlers in HTTPX for recording request and response details
Below is an example test using Allure, Pydantic, and custom fixtures:
@allure.story(AllureStory.BOOKING_RETRIEVAL)
@allure.tag(AllureTag.GET_ENTITY)
@allure.severity(Severity.BLOCKER)
def test_get_booking_success(
self,
booking_private_client: PrivateBookingClient,
created_booking: BookingFixture
):
"""
Positive test: Retrieve specific booking by booking ID.
Validates response matches the created booking data.
"""
booking_id = created_booking.response.bookingid
response = booking_private_client.get_booking_api(booking_id)
allure.dynamic.title(f"GET /booking/{booking_id} - Retrieve specific booking by ID")
assert_status_code(response.status_code, HTTPStatus.OK)
response_data = BookingSchema.model_validate_json(response.text)
validate_json_schema(response.json(), response_data.model_json_schema())
assert_get_booking_response(response_data, created_booking.response.booking)
| Category | Tools |
|---|---|
| Framework | Python 3.11+, Pytest |
| HTTP Client | HTTPX (with logging via custom handlers) |
| Validation | Pydantic, JSON Schema |
| Test Data | Faker |
| Reporting | Allure-pytest, Swagger Coverage Tool |
| Automation | GitHub Actions, Docker Compose |
- Allure 3 Reports: interactive test results with run history
- API Coverage: Swagger specification validation metrics
- Documentation: live documentation based on OpenAPI
- Python 3.11 or higher
- Docker & Docker Compose
- Git
β οΈ Important: the project tests the educational RESTful Booker Platform microservices, deployed via Docker Compose.
git clone https://github.com/mwinteringham/restful-booker-platform.git
cd restful-booker-platform
docker compose up -dcd ..
git clone https://github.com/lobanov-qa/pytest-booker-platform-api.git
cd pytest-booker-platform-apiLinux/Mac:
python3 -m venv venv
source venv/bin/activateWindows:
python -m venv venv
venv\Scripts\activatepip install -e .cp .env.example .envEdit the .env file manually with your settings.
python scripts/wait_for_services.py
pytest tests/ --alluredir=allure-results -vallure serve allure-resultsThis command will open the Allure report in your default browser.
pytest-booker-platform-api/
βββ src/
β βββ clients/ # Domain-oriented API clients
β β βββ auth/ # Authentication service client
β β β βββ auth_client.py # Public/private client methods with Allure steps
β β β βββ routes.py # API endpoint definitions and URL constants
β β β βββ auth_schema.py # Pydantic models for Auth API requests/responses
β β βββ booking/ # Booking service client (structure similar to auth)
β β βββ api_client.py # Base HTTP client with Allure step decorators
β β βββ api_coverage.py # Swagger coverage tracking decorators
β β βββ event_hooks.py # HTTPX event hooks for request/response logging
β β βββ factories.py # Client factory for easy instance creation
β βββ data_factories/ # Factory pattern for test data generation
β β βββ booking_factory.py # Factory methods for booking test data
β β βββ query_factories.py # Factory methods for query parameters
β βββ utils/
β βββ allure/ # Allure configuration and decorators
β βββ assertions/ # Custom assertion libraries
β β βββ base.py # Basic assertion utilities
β β βββ schema.py # JSON Schema validation assertions
β βββ http/curl.py # CURL command generation utilities
β βββ fakers.py # Extended Faker utilities for test data
β βββ logger.py # Structured logging configuration
βββ tests/
β βββ auth/ # Authentication test suites
β β βββ test_authentication.py # Auth API tests with parameterization
β βββ booking/ # Booking service test suites
β βββ test_api_health.py # Health checks for all services
βββ fixtures/ # Pytest fixtures
β βββ auth.py # Authentication-related fixtures
β βββ allure.py # Allure reporting fixtures
βββ scripts/ # Utility scripts
β βββ wait_for_services.py # Service health check utilities
βββ .github/workflows/ # CI/CD pipelines
β βββ ci.yml # Main testing workflow
β βββ deploy-docs.yml # Documentation deployment workflow
Through this project, I have mastered:
- Python / Pytest: writing parameterized tests, using fixtures, organizing modular structure.
- Working with APIs: sending requests (HTTPX), handling authorization, validating responses.
- Code organization: applying SOLID principles and domain-oriented approach for separation of concerns.
- Automation tools: configuring GitHub Actions, generating Allure reports, integrating with Swagger.
- Documentation: maintaining README, setting up documentation publishing via GitHub Pages.
- Quality analysis: tracking API coverage against OpenAPI specifications.
This project has served as a "testing ground" for experimenting with best practices that I want to develop in a professional environment.
Ready for code reviews, discussion of solutions, and feedback.
Looking for an opportunity to start a career as an AQA Engineer to grow within a team and contribute to software quality.
- GitHub: lobanov-qa
- Telegram: lobanov_e_i
- LinkedIn: evgenii-lobanov-qa
