Skip to content

A universal backend testing framework with layered architecture, supporting Java, Go, Python and web systems

License

Notifications You must be signed in to change notification settings

clampist/pytest-test-engine

Repository files navigation

PTE - Universal Backend Testing Framework

Python Pytest License Documentation

A modern, pytest-based universal backend testing framework that supports testing Java, Go, Python and other Web systems. Features layered architecture design, flexible configuration management, comprehensive logging, and database integration.

✨ Key Features

  • 🏗️ Layered Architecture: Clear separation of concerns with core, API, business, and test layers
  • 🔧 Flexible Configuration: YAML-based configuration supporting multiple environments and IDCs
  • 📊 Comprehensive Logging: Automatic LogID generation with end-to-end tracing
  • 🗄️ Database Integration: Complete database testing support with connection pooling
  • Parallel Testing: Built-in support for parallel test execution
  • 📈 Rich Reporting: Allure reports and code coverage analysis
  • 🎯 Test Classification: Separation of framework demo and business case tests
  • 🛠️ Command Line Interface: Easy-to-use pte command for test execution

📚 Documentation

🏗️ Architecture

Layered Architecture Design

The PTE Framework follows a clear layered architecture design:

┌─────────────────────────────────────────────────────────────┐
│                    Test Layer (test/)                       │
│  ┌─────────────────────────────────────────────────────┐   │
│  │              Business Logic Layer (biz/)            │   │
│  │  ┌─────────────────────────────────────────────┐   │   │
│  │  │           API Interface Layer (api/)        │   │   │
│  │  │  ┌─────────────────────────────────────┐   │   │   │
│  │  │  │         Core Framework Layer        │   │   │   │
│  │  │  │              (core/)                │   │   │   │
│  │  │  └─────────────────────────────────────┘   │   │   │
│  │  └─────────────────────────────────────────────┘   │   │
│  └─────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Layer Responsibilities

  • Core Layer (core/): Universal framework functionality, data validation, logging, database operations
  • API Layer (api/): HTTP client wrapper with LogID support and request/response handling
  • Business Layer (biz/): Business logic operations and database integration
  • Test Layer (test/): Test case writing using business layer functionality

Project Structure

pte/
├── config/              # Configuration management
│   ├── env.yaml         # Environment management
│   ├── common.yaml      # Common settings
│   ├── local_test.yaml  # Local environment
│   └── settings.py      # Configuration manager
├── core/                # Core framework layer
│   ├── checker.py       # Universal data validator
│   ├── logger.py        # Logging system
│   ├── db_checker.py    # Database operations
│   └── fixtures.py      # Test fixtures
├── api/                 # API interface layer
│   ├── client.py        # HTTP client wrapper
│   └── config.py        # API configuration
├── biz/                 # Business logic layer
│   └── department/      # Business modules
├── test/                # Test case layer
│   └── department/      # Test modules
├── scripts/             # Utility scripts
└── docs/                # Documentation

Data Flow Architecture

Test Execution Flow

Test Case → Business Operations → API Client → HTTP Request → Target System
    ↓              ↓                ↓            ↓              ↓
  Logging → Business Logging → API Logging → Request Logging → Response Logging

Configuration Flow

Environment Variables → Config Manager → IDC Config → Common Config → Default Values
        ↓                    ↓              ↓            ↓              ↓
    Override Values → Merged Configuration → Framework Components

Logging Flow

Test Execution → Log Class → File Logger → Allure Reporter → Console Output
      ↓            ↓           ↓            ↓              ↓
   LogID → Structured Log → File Output → Allure Report → Console Display

🚀 Getting Started

  1. Install the Framework: Follow the Installation Guide
  2. Quick Start: Read the Quick Start Guide
  3. Learn Usage: Explore the User Guide
  4. Understand Architecture: Review the Architecture Guide
  5. Write Your Tests: Start with the examples in the user guide

🤝 Contributing

We welcome contributions! Please see our contributing guidelines:

  1. Fork the project
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support


PTE Framework - Universal Backend Testing Made Simple 🚀

About

A universal backend testing framework with layered architecture, supporting Java, Go, Python and web systems

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published