PerfDog API Tests
This repository contains automated tests for the PerfDog pet store API, based on the public Swagger Petstore API.
The goal is to validate backend functionality before the frontend is available.
- Python 3.11+
- Pytest
- Requests
- Coloredlogs
perfdog_api_tests/
├── requirements.txt # Python dependencies
├── .gitignore # Excludes venv, cache, etc.
├── tests/ # All test cases
│ ├── conftest.py # Shared fixtures
│ ├── pets/ # Pet-related test cases
│ │ └── test_pets.py
│ ├── orders/ # Order-related test cases
│ │ └── test_orders.py
├── utils/ # Shared logic and helpers
│ ├── api_clients/ # CRUD interfaces
│ │ ├── api_client_pet.py
│ │ └── api_client_order.py
│ ├── endpoints/ # Only builds endpoint URLs
│ │ ├── pets_endpoints.py
│ │ └── orders_endpoints.py
│ ├── assertions.py # Custom assertion helpers
│ ├── decorators.py # @mandatory and @optional markers
│ └── logger.py # Logger config with coloredlogs
-
Clone this repo:
git clone https://github.com/abalestra22/perfdog_api_tests.git cd perfdog_api_tests
-
Create and activate a virtual environment (optional but recommended):
python -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows
-
Install dependencies:
pip install -r requirements.txt
-
Run all tests with:
pytest -v
-
To run only mandatory tests (required for main deliverable):
pytest -v -m mandatory
-
To run only optional (extra/bonus) tests:
pytest -v -m optional
This project uses the public Swagger Petstore API, which is intended for demo purposes. It has a few known limitations:
DELETE /pet/{id}
returns success (200
) but does not actually delete the pet. SubsequentGET
requests still retrieve the "deleted" pet.POST /store/order
accepts apetId
, butGET /store/order/{id}
always returnspetId: 0
, ignoring the value submitted.
Affected tests are marked with @pytest.mark.xfail
. This means:
- They still run to document expected behavior.
- Their failure is ignored by the test suite and will not break CI or
pytest -v
.
This helps keep visibility while acknowledging external API constraints.
Andrea Balestra GitHub: abalestra22