Skip to main content

A lightweight library for REST API testing with HTTP, ASGI, and performance testing

Project description

RapidTest Logo

RapidTest

A lightweight library for REST API testing with ASGI/HTTP mode, fake data generation, and performance testing.

Python Version License PyPI Version Downloads

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

Run tests from the tests directory:

rapidtest run

Scan a FastAPI/Starlette app to generate ASGI tests:

rapidtest scan module:app
  • 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

Run tests from the tests directory:

rapidtest run

Scan a FastAPI/Starlette app to generate ASGI tests:

rapidtest scan module:app

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_requests
  • successful_requests
  • failed_requests
  • success_rate
  • avg_response_time
  • min_response_time
  • max_response_time
  • requests_per_second
  • duration
  • users

Requirements

  • Python >=3.10
  • requests>=2.25.1
  • faker>=13.0.0

Project Info

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rapidtest-0.9.1.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rapidtest-0.9.1-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file rapidtest-0.9.1.tar.gz.

File metadata

  • Download URL: rapidtest-0.9.1.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidtest-0.9.1.tar.gz
Algorithm Hash digest
SHA256 2995f929c87dcc3e4960233d8e6a7283dbfa402a17fcdee5096073c042a69ec7
MD5 ed07cdb5d46b09cb2cc34b156f184fab
BLAKE2b-256 effd7d0c100762ecaf6e2e2d4aac2de0bf7a1e4f59df205db3403a333bfd8720

See more details on using hashes here.

File details

Details for the file rapidtest-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: rapidtest-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidtest-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b65f670d2d24e878e811bf4aee6ae6396dd1dcf02834cbd5307d087050a69a00
MD5 95aa48e413cbb94f3f71d86bb3f1f264
BLAKE2b-256 1e75c13a0167381913e2c9f1b1650bb94dd74c60ba6bcebcf109a90872ba91a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page