Automated testing utility for FastAPI applications
Project description
Fastapi-Testrunner
fastapi_testrunner is an automated testing utility for FastAPI applications.
It extracts the openapi.json schema from your running FastAPI app, automatically generates request data, and tests routes without requiring Postman or manual setup.
All test results are displayed in the terminal and stored in a DeB_FastAPI_Test_Logs folder with date & time logs — making it easy for developers to validate endpoints quickly.
✨ Features
- 🔗 Fetches
openapi.jsonfrom your FastAPIbase_url. - ⚡ Automatically generates request payloads for testing.
- 🧩 Supports:
- Custom input for specific routes
- Adding headers
- Including or excluding routes
- 📝 Saves test results to logs (
DeB_FastAPI_Test_Logs). - 🚀 No need for Postman or curl — just run and test all routes in one go.
🔢 Supported Data Types
- str
- int
- float
- bool
- dict
- list
- enum
- TypedDict
- date
- list[...] → Lists of any of the above types
- 👉 This means your routes with parameters like List[int], List[str], or List[dict] are also supported.
📦 Installation
pip install fastapi_testrunner
🧑💻Examples
✅ Test All Routes Automatically
from fastapi_testrunner import TestFastAPIRoutes
tester = TestFastAPIRoutes()
tester.start_test()
On Class TestFastAPIRoutes
TestFastAPIRoutes(
custom_inputs: CustomInputFormat = {},
base_url: str = 'http://127.0.0.1:8000/',
headers: dict = None,
routes_tocheck: list = [],
routes_touncheck: list = []
)
On Class CustomInputsFormat
CustomInputFormat(TypedDict):
method:str
path:str
isfor_params:bool
isfor_json:bool
data:dict
headers:dict
Example with Custom Input
from fastapi_testrunner import TestFastAPIRoutes, CustomInputFormat
custom_input = CustomInputFormat(
method="POST",
path="/items",
isfor_params=False,
isfor_json=True,
data={"name": "Laptop", "price": 999},
headers={"Authorization": "Bearer TOKEN123"}
)
tester = TestFastAPIRoutes(
base_url="http://127.0.0.1:8000/",
custom_input=custom_input,
routes_touncheck=["/auth/login","/auth/otp"]
)
tester.start_test()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_testrunner-0.1.1.tar.gz.
File metadata
- Download URL: fastapi_testrunner-0.1.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
524e458094b5ebe0cabff23f288d5ccd4a638aa96705b36573feedfce6f3f7f9
|
|
| MD5 |
ff61bb71820acb2358840657b5914d70
|
|
| BLAKE2b-256 |
8e393a5d71a04b2a452c9647fc923c029e7503dbf84b33e8ece75f27921b876c
|
File details
Details for the file fastapi_testrunner-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fastapi_testrunner-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34a11e29a1deb04ff8387c92e8208a1cf0c08311c25010c42405ea3e81a7ef80
|
|
| MD5 |
13b6c97012428fa0168e311609d8ee35
|
|
| BLAKE2b-256 |
bd37f609e8ee316c9b0079c1f8bf252ba43878242ad297d6e3ac2f8ead9abed4
|