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.3.0.tar.gz (403.3 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.3.0-py3-none-any.whl (199.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ptestx-1.3.0.tar.gz
Algorithm Hash digest
SHA256 ed77b806b879ca2f64fa47615eb0fa21a52e5b62bd93ccdcb53fefcc78a39ef8
MD5 100f0117564f946f5621aec68555a790
BLAKE2b-256 8fbbd5cc8bbd9cccdd33f121ea44887aa13bdc29698b8e310a9dc2e617bead8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ptestx-1.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: ptestx-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 199.9 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3aa76d0f12e1c63a7ee2f58136e161d991f6b091fa8132f39c0d990f1bacdb6e
MD5 09452db9969a449d3f145629ab7b8c43
BLAKE2b-256 8f8fab2986c5e9365e61a43c4cb5e552181038b6f6a3493bd8fbed3acbe4cd0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ptestx-1.3.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