综合测试框架 - 用于管理测试环境、测试对象和测试用例的完整生命周期
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e91dd8742e71c281a24c2731e884b464ef5a7c2893eed4214362d12ad2933cf1
|
|
| MD5 |
e2f86bd895aa2dc16cb64bfaca9cc828
|
|
| BLAKE2b-256 |
b22cda3527de23e204cd4c660624a57b96241b0fa77eebf2c7113f11546c7ee0
|
Provenance
The following attestation bundles were made for ptestx-1.2.0.tar.gz:
Publisher:
cd.yml on wu-champion/ptest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ptestx-1.2.0.tar.gz -
Subject digest:
e91dd8742e71c281a24c2731e884b464ef5a7c2893eed4214362d12ad2933cf1 - Sigstore transparency entry: 983658741
- Sigstore integration time:
-
Permalink:
wu-champion/ptest@68fba21434c79ffc1ae086232b0fec58b9e30379 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/wu-champion
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@68fba21434c79ffc1ae086232b0fec58b9e30379 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fc56159fffc28a83d6d5110bf2332ea985b794394690b599a59721dd5516d5d
|
|
| MD5 |
a02fb1d07dc07a90aecf828c9d93efa7
|
|
| BLAKE2b-256 |
729f313235367f3e5f5dfafa0d8f8b19ea621cf46269baf6d84dcfe91eb7d9af
|
Provenance
The following attestation bundles were made for ptestx-1.2.0-py3-none-any.whl:
Publisher:
cd.yml on wu-champion/ptest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ptestx-1.2.0-py3-none-any.whl -
Subject digest:
3fc56159fffc28a83d6d5110bf2332ea985b794394690b599a59721dd5516d5d - Sigstore transparency entry: 983658749
- Sigstore integration time:
-
Permalink:
wu-champion/ptest@68fba21434c79ffc1ae086232b0fec58b9e30379 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/wu-champion
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@68fba21434c79ffc1ae086232b0fec58b9e30379 -
Trigger Event:
release
-
Statement type: