Skip to main content

Comprehensive Python framework for automated testing of web applications

Project description

py-web-automation

A comprehensive Python framework for automated testing of web applications, providing clients for API testing (REST, GraphQL, gRPC, SOAP), WebSocket communication, UI testing, and database operations.

Features

  • Multiple API Protocols: REST, GraphQL, gRPC, SOAP, and WebSocket support
  • Browser Automation: Playwright-based UI testing
  • Database Testing: Support for PostgreSQL, MySQL, and SQLite with adapter pattern
  • Type Safety: Complete type annotations with 100% coverage
  • Async-First: Built on async/await for high performance
  • Request Builder: Fluent API for constructing complex HTTP requests
  • Response Validation: Fast schema validation using msgspec
  • Error Handling: Structured exception hierarchy
  • Configuration Management: Flexible configuration with environment variables and YAML support

Installation

# Using uv (recommended)
uv add py-web-automation

# Or using pip
pip install py-web-automation

Quick Start

API Testing

import asyncio
from py_web_automation import ApiClient, Config

async def main():
    config = Config(timeout=30)
    async with ApiClient("https://api.example.com", config) as api:
        result = await api.make_request("/users/1", method="GET")
        print(f"Status: {result.status_code}, Success: {result.success}")

asyncio.run(main())

UI Testing

import asyncio
from py_web_automation import UiClient, Config

async def main():
    config = Config(timeout=30)
    async with UiClient("https://example.com", config) as ui:
        await ui.setup_browser()
        await ui.page.goto("https://example.com")
        await ui.click_element("#button")
        await ui.take_screenshot("result.png")

asyncio.run(main())

Database Testing

import asyncio
from py_web_automation import DBClient, Config

async def main():
    config = Config()
    db = await DBClient.create(
        "https://example.com",
        config,
        db_type="postgresql",
        connection_string="postgresql://user:pass@localhost/db"
    )
    async with db:
        results = await db.execute_query("SELECT * FROM users WHERE id = :id", {"id": 1})
        print(results)

asyncio.run(main())

Available Clients

  • ApiClient: HTTP REST API testing
  • GraphQLClient: GraphQL API testing
  • GrpcClient: gRPC API testing
  • SoapClient: SOAP API testing
  • WebSocketClient: WebSocket communication
  • UiClient: Browser automation with Playwright
  • DBClient: Database operations with multiple backend support

Documentation

Requirements

  • Python >= 3.13
  • See pyproject.toml for dependencies

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Changelog

See CHANGELOG.md for a list of changes and version history.

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

py_web_automation-1.0.0.tar.gz (32.0 kB view details)

Uploaded Source

Built Distribution

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

py_web_automation-1.0.0-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file py_web_automation-1.0.0.tar.gz.

File metadata

  • Download URL: py_web_automation-1.0.0.tar.gz
  • Upload date:
  • Size: 32.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for py_web_automation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ec3382ae11f26b387f4718b602718d08123cbd41b8c383a38703608fe4c070ad
MD5 2360d98dcf39f0d59b17bdf254636093
BLAKE2b-256 6688bb3223df2c6642ea15e2de28ff16571e79b14ab9a25efa630ead48d03b9d

See more details on using hashes here.

File details

Details for the file py_web_automation-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for py_web_automation-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdefa29a851b74ef3ea1fbb543783567c38fe141c1b3389d6a314f78011e48ad
MD5 8c3a9e18c5a797cd8ce8ceb261867ccc
BLAKE2b-256 cce94c77883ca2a94eabd5f2f78fa134f2e98ca94fd8aa16c98cd30261c5d644

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