Skip to main content

mtkit — AI 全站测试工程师

计划先行生成标准 XMind 测试用例(质量门禁把关),体检修复用例资产,交互式测试咨询与问题定位指导;使用即训练,越用越成熟。

流水线

flowchart LR
    IN[输入: 方案.docx + 样例.xmind + 后端仓库 + 自定义文档] --> READ[读取与文档体检]
    READ --> FACTS[代码事实扫描<br/>九语言接口/SQL]
    FACTS --> PLAN[测试用例输出计划<br/>设计方法 + 构建者建议]
    PLAN --> AUTH{授权}
    AUTH -->|确认| CONTRACT[契约 JSON]
    CONTRACT --> GATE[质量门禁<br/>review + AI 审查]
    GATE --> RENDER[渲染 XMind]
    RENDER --> CHECK[校验 + 漏测对比]
    CHECK --> OUT[交付: XMind + 缺陷点汇总 + 工作痕迹]

快速上手(零依赖)

# 1. 生成 XMind(纯标准库,无需任何安装)
cd d:\mtkit
mtkit gen -i examples/sample.json -o 用例.xmind

# 2. 校验与统计
mtkit validate -i 用例.xmind
mtkit info -i 用例.xmind

可选依赖(用到才装):.docx 解析 pip install python-docx;数据库直连 pip install pymysql。

一键安装(含 Qoder 插件注册与可选依赖)

# 方式一(推荐,新机器零门槛):PyPI 安装 CLI
pip install mtkit

# 方式二:仓库根目录执行(含可选依赖自动安装)
python install.py        # 或双击 install.bat

# 方式三:输入 git 地址自动拉取安装
python install.py --git <git 地址> [--dir 目标目录]

安装完成后重启 Qoder,对话框输入 / 应列出 mtkit-gen-xmind,或直接自然语言触发。

Qoder 插件注册:skills/、commands/ 不在 PyPI 包中,pip 安装后执行 mtkit install --git <git 地址>(或先设置环境变量 MTKIT_INSTALL_GIT)拉取完整仓库并注册插件。

命令

命令 作用 示例
gen 契约/数据 → .xmind mtkit gen -i 契约.json -o 用例.xmind
gather 方案+样例+代码 → 生成上下文 mtkit gather -i 方案.docx --hist 样例.xmind -r 后端 -o ctx.json
facts 九语言代码事实扫描 mtkit facts -r 后端 -o facts.json
review 契约质量门禁 mtkit review -i 契约.json -f facts.json
audit 用例资产体检(检索不合适用例) mtkit audit -i 旧用例.xmind -f facts.json
db 数据库只读接入(check/schema/verify) mtkit db verify -c db.json -i 契约.json
validate / info 校验 / 统计 .xmind mtkit validate -i 用例.xmind
diff 漏测对比 mtkit diff -i 用例.xmind -f facts.json -d 方案.docx
contract / tree 用例 ↔ 契约互转 / 还原树 mtkit contract -i 用例.xmind -o 契约.json
track 测试管理:执行记录/报告/趋势 mtkit track record --case 用例 --result pass
bug 缺陷库:登记/清单/关闭/统计 mtkit bug add --title 缺陷 --severity P1
evolve 自进化:备份/恢复/清单/清理 mtkit evolve backup 文件
asset 用例资产老化检测(治理) mtkit asset --dir 输出目录 --days 30

契约格式(唯一输入约定):

{"chapters":[{"t":"章节","cases":[{"t":"tc-P0-功能测试:用例名",
  "pc":["前置"],"steps":["步骤"],"expects":["预期"],"sql":["SELECT ..."]}]}]}

数据库接入(可选,严格只读)

db.json 四种数据源(type 字段):

{"type":"cli","connect":{"cmd":"mysql -h{host} -u{user} -p{pass} {db} -N -e \"{sql}\"","host":"10.0.0.1","user":"ro","pass":"${DB_PASS}","db":"bill_db"}}
{"type":"driver","driver":"pymysql","host":"10.0.0.1","user":"ro","password":"${DB_PASS}","db":"bill_db"}
{"type":"http","url":"https://gw.example.com/query","token":"${DB_TOKEN}"}
{"type":"file","path":"schema.json"}

仅允许 SELECT/EXPLAIN/DESC/SHOW;写操作一律拒绝。密码用 ${ENV_VAR} 环境变量。

Qoder 集成(2 步)

  1. Qoder 插件管理 → 本地插件 → 选择 d:\mtkit
  2. 对话输入:
    • 生成用例:"用 mtkit 生成 XMind 测试用例:方案 xxx.docx,样例 xxx.xmind,后端仓库 xxx"
    • 测试咨询:"这个功能怎么测?" / "线上报错了帮我看看" / "是不是 bug?"

技能时序

sequenceDiagram
    participant U as 使用者
    participant A as AI(测试构建者)
    U->>A: 输入三件套 + 可选文档/db
    A->>U: 文档体检(缺陷点+建议,逐条确认)
    A->>A: gather + facts + 经验库加载
    A->>U: 测试用例输出计划(设计方法+构建者建议)
    U->>A: 授权(可增删调整)
    A->>A: 生成契约 → 质量门禁 → 修正循环
    A->>U: 用例调整建议(逐条确认)
    A->>A: 渲染 XMind → 校验 → 漏测对比
    A->>U: 交付(XMind/缺陷点汇总/工作痕迹)+ 训练沉淀

迭代更新(editable 安装,无需重装)

pip install --force-reinstall --no-deps -e d:\mtkit   # 仅在需要时
python -m unittest                                     # 自检
  • 插件侧:仓库文件更新即生效,仅 plugin.json 版本变化需重启 Qoder
  • 自我迭代:AI 使用中发现改进点会写入 .mtkit-work/improvements.json;在 .mtkit.json 开启 auto_improve 并授权后,AI 可自行优化并自验(详见 skills 文档)
  • 详细说明:见 CHANGELOG.md、skills/mtkit-gen-xmind/(技能与规范)

PyPI 发布(维护者指南)

# 1. 构建
python -m pip install build twine
python -m build                    # 生成 dist/mtkit-<版本>.tar.gz + .whl

# 2. 建议先传 TestPyPI 验证
python -m twine upload --repository testpypi dist/*
pip install -i https://test.pypi.org/simple/ mtkit
mtkit --help                       # 验证 CLI

# 3. 验证 OK 后正式发布(需项目级 API token + PyPI 账户 2FA)
python -m twine upload dist/*      # 输入 API token

发布后新同事的安装流程(最终形态):

pip install mtkit          # 只装 Python CLI(纯标准库,秒装)
mtkit install --git <git 地址>   # 拉取完整仓库 + 注册 Qoder 插件(需内网仓库地址)
# 重启 Qoder → / 出现 mtkit-gen-xmind

Metadata

Release files for mtkit 1.16.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mtkit 1.16.2
File Size Uploaded Provenance Actions
mtkit-1.16.2.tar.gz 78.5 kB Without provenance Details for mtkit-1.16.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mtkit 1.16.2
File Interpreter ABI Platform Actions
mtkit-1.16.2-py3-none-any.whl Python 3 none any Details for mtkit-1.16.2-py3-none-any.whl

Total release size: 164.9 kB

Release files / mtkit-1.16.2.tar.gz

Download URL mtkit-1.16.2.tar.gz
Size 78.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6653c650c876747254e744a518e8fe6f400a227717435bfb573ab19d225a78f3
BLAKE2b-256 checksum
How to use checksums
7a0cb756c499cac395d2b0bbd3ffabf918ab9677418456e3a0cfb7d9e6754bc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.7

Release files / mtkit-1.16.2-py3-none-any.whl

Download URL mtkit-1.16.2-py3-none-any.whl
Size 86.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d674db663e50ca9d24a3f305230b039e46000ab0d80b34006da4eff963385e3
BLAKE2b-256 checksum
How to use checksums
2503fa92b204729466941fa35e729c05415e3481bc6b59d1d07b30930f4b0d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.7

Security for mtkit 1.16.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page