Skip to main content

A short description of your package

Project description

API Testing Framework for Python

This Python package is designed to accelerate the development of API tests by providing a robust and flexible framework. It integrates seamlessly with Allure for detailed reporting, ensuring that every request and assertion is logged and visible in the test reports.


Table of Contents

  1. Overview
  2. Features
  3. Installation
  4. Usage
  5. Examples
  6. Contributing
  7. License

Overview

This framework simplifies the process of creating API tests by encapsulating HTTP requests and responses into reusable components. The Client class manages API sessions, while the ApiResponse class provides methods for validating HTTP responses. All interactions and assertions are automatically logged in Allure reports, making it easier to debug and analyze test results.


Features

  • Simplified Request Management: Easily send HTTP requests using the Client class.
  • Response Validation: Use the ApiResponse class to validate status codes, response times, JSON data, headers, and more.
  • Allure Integration: Automatically log request and response details in Allure reports.
  • Method Chaining: Chain multiple assertions for cleaner and more readable test code.
  • Session Support: Optionally use persistent sessions for better performance during test execution.

Installation

To install this package, you can use pip. First, ensure that you have Python 3.11+ installed on your system.

pip install rapidus

Alternatively, if you are using this as part of a project, include it in your requirements.txt file:

rapidus

Usage

Step 1: Import the Classes

from rapidus import Client

Step 2: Initialize the Client

base_url = "https://api.example.com"
client = Client(base_url=base_url, use_session=True)  # Use sessions for better performance

Step 3: Send Requests and Validate Responses

client.send_request(
    method="GET",
    endpoint="/users",
    headers={"Authorization": "Bearer <token>"}
).assert_status_code(200).assert_response_time(500).assert_json_contains("id", 123)

Step 4: Close the Session (If Used)

client.close()

Examples

Example 1: Basic GET Request

from rapidus import Client


Client(base_url="https://jsonplaceholder.typicode.com").send_request("GET", "/posts/1").assert_status_code(200).assert_json_contains("userId", 1)

Example 2: POST Request with JSON Payload

from rapidus import Client


client = Client(base_url="https://jsonplaceholder.typicode.com", use_session=True)

payload = {
    "title": "foo",
    "body": "bar",
    "userId": 1
}

response = client.send_request(
    method="POST",
    endpoint="/posts",
    json=payload
)

response.assert_status_code(201).assert_json_contains("id")
client.close()

Contributing

We welcome contributions from the community! If you'd like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/new-feature).
  3. Make your changes and commit them (git commit -m "Add new feature").
  4. Push the branch (git push origin feature/new-feature).
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


Contact

If you have any questions or need further assistance, feel free to open an issue or contact us directly.

Happy testing! 🚀

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

rapidus-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

rapidus-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file rapidus-0.1.0.tar.gz.

File metadata

  • Download URL: rapidus-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for rapidus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d7fe2f03e296fddf7ae3d154e2b84573881d561c2fd395c5250e2cc57ed0ac4d
MD5 67bbea021094efb69373c2af507dd6c9
BLAKE2b-256 8d19d53d16e3a6665402b3929bd4d93941908424929a236d248d965afd681cf4

See more details on using hashes here.

File details

Details for the file rapidus-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rapidus-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for rapidus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc232bb356b75317ac066645d63592fe2682ac2ef905ef02b06b944aaa133982
MD5 de70d501422d7649e7c8fffa4afa288d
BLAKE2b-256 77d3a41bfbbe63224f8b3cc29b671303edcd156c72dcf2b4f50da194330edabd

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