Skip to main content

A comprehensive testing framework for REST APIs with functional and performance testing capabilities

Project description

RapidTest Logo

RapidTest

A lightweight library for REST API testing with functional checks, ASGI direct mode, fake data generation, and basic performance testing.

Features

  • Simple HTTP testing with GET, POST, PUT, PATCH, DELETE
  • Built-in response validation (status, JSON body, required keys)
  • ASGI direct mode for testing app instances without running an HTTP server
  • Fake data generation with Faker
  • Basic load 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 (HTTP mode)

from rapidtest import Test, StatusCode

api = Test(url="http://localhost:8000")

# GET with status + key validation
api.get(
    path="/health",
    status=StatusCode.OK_200,
    keys=["message"]
)

# POST with request body + expected response body
payload = {"username": "hector", "password": "secret"}
api.post(
    path="/login",
    json=payload,
    status=StatusCode.OK_200,
    keys=["token"]
)

Quick Start (ASGI mode)

Use this when you want to test your ASGI app directly (for example FastAPI) without network overhead.

from fastapi import FastAPI
from rapidtest import Test, StatusCode

app = FastAPI()

@app.get("/ping")
def ping():
    return {"ok": True}

tester = Test(app=app, asgi_mode=True)

tester.get(
    path="/ping",
    status=StatusCode.OK_200,
    json={"ok": True}
)

Data Generation

from rapidtest import data

auth = data.generate_auth_user()

print(auth)  # {"username": "...", "password": "..."}

Useful helpers include:

  • generate_name()
  • generate_email()
  • generate_phone()
  • more..

Performance Testing

from rapidtest import Performance

perf = Performance(
    base_url="http://localhost:8000",
    users=20,
    duration=15,
    timeout=10
)

perf.add_get_task(endpoint="/health")
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.7
  • 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.5.2.tar.gz (17.3 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.5.2-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rapidtest-0.5.2.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for rapidtest-0.5.2.tar.gz
Algorithm Hash digest
SHA256 97e187bcfe9b6110944a4930d4840a422691e7f25a7454d109b3ccd99d27b30b
MD5 92c12fdd3488d391899397442bf8ef03
BLAKE2b-256 a8b1b0fe3735b7fae4bf7231d1abb6acb30789f91a35f747c928ce88035e5ca2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rapidtest-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for rapidtest-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 07276113e979cea59e1e97e020ab48cd679af1c60d022b25a1545b4cea6f378d
MD5 32b3b7d1c1e0a489f08cfdb3ec4eb9b0
BLAKE2b-256 641c9c5ce1d5f60ca8c86bb09d9c6e3f0e0d308d71fd72c0ef7117f5e979d41c

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