A lightweight library for REST API testing with HTTP, ASGI, and performance testing
Project description
RapidTest
A lightweight library for REST API testing with ASGI/HTTP mode, fake data generation, and performance testing.
Features
- ASGI Testing - Test FastAPI/Starlette apps directly without HTTP server
- HTTP Testing - Test external APIs with
GET,POST,PUT,PATCH,DELETE - Built-in response validation (status, JSON body, required keys)
- Fake data generation with Faker
- Performance testing with concurrent users (
threading+requests) - Test any endpoint with just one line of code
Installation
pip install rapidtest
CLI
Generate a test skeleton file:
rapidtest init
- ASGI Testing - Test FastAPI/Starlette apps directly without HTTP server
- HTTP Testing - Test external APIs with
GET,POST,PUT,PATCH,DELETE - Built-in response validation (status, JSON body, required keys)
- Fake data generation with Faker
- Performance testing with concurrent users (
threading+requests) - Test any endpoint with just one line of code
Installation
pip install rapidtest
CLI
Generate a test skeleton file:
rapidtest init
Quick Start (ASGI mode)
Use this when you want to test your ASGI app directly (for example FastAPI) without network overhead.
from backend.main import app
from rapidtest import ASGITest, StatusCode
tester = ASGITest(app=app)
tester.get(
path="/ping",
status=StatusCode.OK_200,
json={"ok": True}
)
Output:
✅ 1. PASSED
time: 0.01 s
Quick Start (HTTP mode)
from rapidtest import HTTPTest, StatusCode
api = HTTPTest(url="http://localhost:8000")
api.get(
path="/health",
status=StatusCode.OK_200,
keys=["message"]
)
payload = {"username": "hector", "password": "secret"}
api.post(
path="/login",
json=payload,
status=StatusCode.OK_200,
keys=["token"]
)
Output:
✅ 1. PASSED
✅ 2. PASSED
time: 0.05 s
Data Generation
from rapidtest import Data
auth = Data.generate_auth_user()
print(auth) # {"username": "...", "password": "..."}
Useful helpers include:
generate_name()generate_email()- And more...
Performance Testing
from rapidtest import Performance
perf = Performance(
base_url="http://localhost:8000",
users=20,
duration=15,
timeout=10
)
# Add multiple endpoints with different methods
perf.add_task(endpoint="/health", method="GET")
perf.add_task(endpoint="/login", method="POST", json={"user": "test"})
results = perf.run()
Returned metrics:
total_requestssuccessful_requestsfailed_requestssuccess_rateavg_response_timemin_response_timemax_response_timerequests_per_seconddurationusers
Requirements
- Python
>=3.10 requests>=2.25.1faker>=13.0.0
Project Info
- Version:
0.7.2 - Author: Hector Rosales
- License: MIT
- Homepage: https://github.com/hector-2710/rapidtest
- Issues: https://github.com/hector-2710/rapidtest/issues
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 rapidtest-0.7.2.tar.gz.
File metadata
- Download URL: rapidtest-0.7.2.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
364d828c5926c3804a47c6610e2356167bd962f7a6fc862957a15a747e33eef4
|
|
| MD5 |
d680ef637f8e46dbc46d61fe4b0310d7
|
|
| BLAKE2b-256 |
3d47ab8c0434038192260ea6f6af4d4f60a96f8fd357aae75ed8c27a2e6207b6
|
File details
Details for the file rapidtest-0.7.2-py3-none-any.whl.
File metadata
- Download URL: rapidtest-0.7.2-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2112c8242b53744c4f6e24c2146d3bab3f5d4668ebc959ac05a2a64ac53c8d6e
|
|
| MD5 |
09e2b6c376fe43463448c0b33694c0a1
|
|
| BLAKE2b-256 |
941d4878142d39dc962728c42256b3778bf81b4ce460f8962e82363b6df9bbbb
|