Api Test Automation

👤 kaiyuelv 📦 v1.0.0 ⭐ 4.4 ⬇️ 5.1K 下載
💻 開發程式設計 免費

📖 技能介紹


name: api-test-automation description: API介面測試自動化工具,支援REST/GraphQL,包含介面測試、效能測試、契約測試、Mock服務等功能 | API Test Automation for REST/GraphQL with performance, contract testing and Mock services homepage: https://github.com/kaiyuelv/api-test-automation category: devops tags: - api - testing - rest - graphql - pytest - automation - performance - mock version: 1.0.0


API Test Automation

API介面測試自動化工具,支援REST/GraphQL,包含介面測試、效能測試、契約測試、Mock服務等功能。

概述

本Skill提供完整的API測試解決方案,支援: - REST API 功能測試 - GraphQL 查詢測試 - 效能測試(併發、響應時間、吞吐量) - 契約測試(OpenAPI/Swagger 驗證) - Mock 服務 - 測試報告生成

依賴

  • Python >= 3.8
  • requests >= 2.28.0
  • httpx >= 0.24.0
  • pytest >= 7.0.0
  • pytest-asyncio >= 0.21.0
  • schemathesis >= 3.19.0
  • hypothesis >= 6.82.0
  • aiohttp >= 3.8.0
  • uvicorn >= 0.23.0
  • starlette >= 0.27.0
  • jsonschema >= 4.19.0
  • pyyaml >= 6.0
  • allure-pytest >= 2.13.0

檔案結構

api-test-automation/
├── SKILL.md                  # 本檔案
├── README.md                 # 使用文件
├── requirements.txt          # 依賴宣告
├── examples/
│   └── run_tests.py         # 使用示例
├── tests/
│   └── test_api_suite.py    # 單元測試
└── src/
    ├── __init__.py
    ├── rest_client.py       # REST API 客戶端
    ├── graphql_client.py    # GraphQL 客戶端
    ├── performance.py       # 效能測試工具
    ├── contract_tester.py   # 契約測試
    ├── mock_server.py       # Mock 服務
    └── reporter.py          # 報告生成

快速開始

from api_test_automation import RestClient, GraphQLClient, PerformanceTester

# REST API 測試
client = RestClient(base_url="https://api.example.com")
response = client.get("/users")
assert response.status_code == 200

# GraphQL 測試
graphql = GraphQLClient(endpoint="https://api.example.com/graphql")
result = graphql.query("{ users { id name } }")

許可證

來源於7w4.net。

MIT


API Test Automation (English)

A comprehensive API testing automation tool supporting REST/GraphQL with functional testing, performance testing, contract testing, and Mock services.

Overview

This Skill provides a complete API testing solution: - REST API functional testing - GraphQL query testing - Performance testing (concurrency, response time, throughput) - Contract testing (OpenAPI/Swagger validation) - Mock services - Test report generation

Dependencies

  • Python >= 3.8
  • requests >= 2.28.0
  • httpx >= 0.24.0
  • pytest >= 7.0.0
  • pytest-asyncio >= 0.21.0
  • schemathesis >= 3.19.0
  • hypothesis >= 6.82.0
  • aiohttp >= 3.8.0
  • uvicorn >= 0.23.0
  • starlette >= 0.27.0
  • jsonschema >= 4.19.0
  • pyyaml >= 6.0
  • allure-pytest >= 2.13.0

File Structure

api-test-automation/
├── SKILL.md                  # This file
├── README.md                 # Usage documentation
├── requirements.txt          # Dependencies
├── examples/
│   └── run_tests.py         # Usage examples
├── tests/
│   └── test_api_suite.py    # Unit tests
└── src/
    ├── __init__.py
    ├── rest_client.py       # REST API client
    ├── graphql_client.py    # GraphQL client
    ├── performance.py       # Performance testing tools
    ├── contract_tester.py   # Contract testing
    ├── mock_server.py       # Mock server
    └── reporter.py          # Report generation

Quick Start

from api_test_automation import RestClient, GraphQLClient, PerformanceTester

# REST API Testing
client = RestClient(base_url="https://api.example.com")
response = client.get("/users")
assert response.status_code == 200

# GraphQL Testing
graphql = GraphQLClient(endpoint="https://api.example.com/graphql")
result = graphql.query("{ users { id name } }")

License

MIT

🤖 AI 評測

這個工具功能比較齊全,能做 API 測試、效能測試和 Mock 服務,文件寫得清楚易懂。但存在明顯缺陷:報告生成模組缺少必要的匯入會導致程式報錯,Mock 服務的部分功能是空殼實現,實際用不起來。整體完成度一般,需要修復這些問題才能正常使用。推薦等開發者修復後再嘗試。

📊 多維度評分

適應性4.2
規範性4.2
有效性4.5
可靠性4.5
可信度4.8

📁 包含檔案 (14 個)

📄 README.md 5.9 KB
📄 SKILL.md 4 KB
📄 _meta.json 138 B
📄 examples/run_tests.py 12.5 KB
📄 requirements.txt 489 B
📄 src/__init__.py 685 B
📄 src/assertions.py 6.1 KB
📄 src/contract_tester.py 5.8 KB
📄 src/graphql_client.py 4 KB
📄 src/mock_server.py 6.4 KB
📄 src/performance.py 6.7 KB
📄 src/reporter.py 8.1 KB
📄 src/rest_client.py 5.4 KB
📄 tests/test_api_suite.py 24.5 KB