Skip to main content

综合测试框架 - 用于管理测试环境、测试对象和测试用例的完整生命周期

Project description

ptest - 综合测试框架

注意: v1.2+ 包名已改为 ptestx,安装命令: pip install ptestx

ptest 是一个全面的测试框架,用于管理测试环境、测试对象、测试用例、测试套件和测试数据。

📚 完整文档

完整的文档请访问 docs/ 目录:

🚀 快速开始

安装

pip install ptestx

快速开始示例

# 查看快速开始示例
ls examples/

# 运行基础 API 测试示例
cd examples/01_basic_api_test
pytest ...

初始化测试环境

ptest init --path /home/test/

管理测试对象

以Mysql为例

# 安装MySQL对象
ptest obj install mysql my_mysql_db --version 9.9.9

# 启动MySQL对象
ptest obj start my_mysql_db

# 列出所有对象
ptest obj list

管理测试用例

# 添加测试用例
ptest case add mysql_connection_test '{"type": "connection", "description": "Test MySQL connection"}'

# 运行特定测试用例
ptest case run mysql_connection_test

# 运行所有测试用例
ptest run all

# 并行执行
ptest case run all --parallel --workers 4

测试套件管理 (v1.2+)

# 创建套件
ptest suite create my_suite

# 运行套件
ptest suite run my_suite

# 并行执行
ptest suite run my_suite --parallel --workers 4

# 失败停止
ptest suite run my_suite --stop-on-failure

# 预览模式
ptest suite run my_suite --dry-run

Mock 服务管理 (v1.2+)

# 启动 Mock 服务
ptest mock start --config mock_config.yaml

# 停止 Mock 服务
ptest mock stop --name payment_gateway

# 查看 Mock 列表
ptest mock list

数据生成 (v1.2+)

# 生成测试数据
ptest data generate user --count 100

# 生成 SQL INSERT 语句
ptest data generate user --format sql --table users --dialect mysql

# 查看支持的数据类型
ptest data types

API 契约管理 (v1.2+)

# 导入 OpenAPI 契约
ptest contract import --source https://api.example.com/openapi.json

# 查看契约列表
ptest contract list

# 验证契约
ptest contract validate my_contract

生成报告

# 生成HTML报告
ptest report --format html

# 生成JSON报告
ptest report --format json

查看状态

ptest status

命令别名

同时提供了p作为简写命令:

p init --path /home/test/
p obj install mysql my_mysql_db
p run all

📖 更多信息

查看 docs/ 目录获取完整的文档,包括:

  • 详细的架构设计文档
  • 数据库配置和使用指南
  • 测试执行引擎说明
  • 开发规范和贡献指南
  • API 接口文档

ptest - 综合测试框架,让测试变得简单而强大!

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

ptestx-1.2.0.tar.gz (389.6 kB view details)

Uploaded Source

Built Distribution

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

ptestx-1.2.0-py3-none-any.whl (189.3 kB view details)

Uploaded Python 3

File details

Details for the file ptestx-1.2.0.tar.gz.

File metadata

  • Download URL: ptestx-1.2.0.tar.gz
  • Upload date:
  • Size: 389.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ptestx-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e91dd8742e71c281a24c2731e884b464ef5a7c2893eed4214362d12ad2933cf1
MD5 e2f86bd895aa2dc16cb64bfaca9cc828
BLAKE2b-256 b22cda3527de23e204cd4c660624a57b96241b0fa77eebf2c7113f11546c7ee0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ptestx-1.2.0.tar.gz:

Publisher: cd.yml on wu-champion/ptest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ptestx-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: ptestx-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 189.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ptestx-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fc56159fffc28a83d6d5110bf2332ea985b794394690b599a59721dd5516d5d
MD5 a02fb1d07dc07a90aecf828c9d93efa7
BLAKE2b-256 729f313235367f3e5f5dfafa0d8f8b19ea621cf46269baf6d84dcfe91eb7d9af

See more details on using hashes here.

Provenance

The following attestation bundles were made for ptestx-1.2.0-py3-none-any.whl:

Publisher: cd.yml on wu-champion/ptest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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