Skip to main content

tuner-testkit

发行名 tuner-testkit,导入名 tuner_testkit。给被测系统(SUT)测试仓提供公共运行库与 CLI(db / API / Web UI / 录制 / mock),以及 Cursor/git DNA(rules、skills、hooks)。

业务资产(page/api objects、action words、features)留在各项目仓packages/tests/,不进本包。平台发新版本后,下游用 uv 按需升级,不必再整树拷贝运行库。


标准作业流程

1. 安装 tuner-testkit

还没有任何项目仓时,先把 CLI 装到工具环境:

uv tool install "tuner-testkit[db,api]"

需要 headed 录制或 Playwright 时加上对应 extra(见下方 extras)。已有项目仓则在该仓根目录:

uv add "tuner-testkit[db,api]>=4.0.0"
uv sync

入口命令是 tuner-inittuner-dnatuner-recorder 等(tuner-*),没有 tuner-testkit 这个 script。

2. 初始化测试仓

tuner-init scaffold ../my-sut-tests
cd ../my-sut-tests
uv sync

scaffold 会铺六层目录、写入依赖 tuner-testkitpyproject.toml,并执行一次 tuner-dna sync(把 .cursor/docs/spec/tools/git-hooks/ 放进项目树)。可在任意目录运行,不必先有测试仓。不要用 tuner-testkit init repo

Web UI / 合录按需再加 extra:

uv add "tuner-testkit[web-ui]"
uv add "tuner-testkit[recorder]"

3. 开始写业务

项目仓里写,不要改 site-packages 里的 kit:

你写什么 放哪里
页面 / 接口资产 packages/page_objects/packages/api_objects/
业务动作 packages/action_words/
BDD / pytest tests/features/tests/pytest/
知识(DDL、用例) assets/
本仓私有工具 apps/python -m apps.<name>

代码里 from tuner_testkit.db import … / from tuner_testkit.page_test import …。密钥只放本机 config/env_local.py 或环境变量(TUNER_ENVTUNER_DB_<ALIAS>_*),不要提交

录制产物同样写到项目仓 packages/,不会写进 venv。

4. 升级已发布的 kit

平台把新版本推上 PyPI 之后,在项目仓改依赖并同步 DNA——两步都要做

# 改版本:直接改 pyproject.toml,或
uv add "tuner-testkit[db,api]==4.1.0"
uv sync

# Cursor 不会读 site-packages 里的 rule/skill,必须再铺进本仓并提交
tuner-dna sync
git add -A && git commit

只跑 uv add / uv sync 只会更新运行库与 CLI;AI 约束和 git hooks 仍停留在旧 DNA。检查是否与当前安装的 kit 一致:

tuner-dna check

一个 wheel 不能「只升 web-ui、钉死旧 db」。[phone-ui] 为预留空 extra,4.0 未实现。


extras

extra 内容
(默认 wheel) config / loggingtuner-inittuner-dnatuner-dump-ddl
[db] MySQL / SQL Server / PostgreSQL
[api] api_test(HTTP 客户端)
[web-ui] page_test + Playwright
[phone-ui] 预留,无实现
[recorder] 合录 / 仅 UI / mitmproxy 代理
[mock] 按冻结的 api_objects 回放
[excel] / [fake] 表格 / 假数据
[bdd] / [test] / [dev] behave / pytest / 开发全集

CLI 与 python -m tuner_testkit.… 等价,例如 tuner-recordertuner-page-recordertuner-api-recordertuner-mock-server


安全

不得把 token、cookie、Authorization、密码、session 写入仓库(含 capture 与 api_objects)。凭证只允许运行时注入。


本仓库(平台源码)

克隆后在仓库根目录开发 kit 本身:

uv venv
uv sync --extra dev

下游迁移清单见 docs/changelog/TEMPLATE-4.0.0.md。平台能力地图见 INDEX.md

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tuner_testkit-4.0.2.tar.gz (274.4 kB view details)

Uploaded Source

Built Distribution

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

tuner_testkit-4.0.2-py3-none-any.whl (355.0 kB view details)

Uploaded Python 3

File details

Details for the file tuner_testkit-4.0.2.tar.gz.

File metadata

  • Download URL: tuner_testkit-4.0.2.tar.gz
  • Upload date:
  • Size: 274.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tuner_testkit-4.0.2.tar.gz
Algorithm Hash digest
SHA256 d680199286101857361d7cf9e7fa00edff69b3a2844c80c31ddc288a6da02aae
MD5 da6d0f790a6e5ee9bd829b4993e7d46a
BLAKE2b-256 955d538bdc52715751ac10b41c30fa9aef82d362082cbe6a3daa123aa0b06ac9

See more details on using hashes here.

File details

Details for the file tuner_testkit-4.0.2-py3-none-any.whl.

File metadata

  • Download URL: tuner_testkit-4.0.2-py3-none-any.whl
  • Upload date:
  • Size: 355.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tuner_testkit-4.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 216c78951d29e412b280b6b25b7b0e159b076faf1c293042397297adffb7bc14
MD5 ade383e41d861de32be0868381726cdc
BLAKE2b-256 0fb88d48ffc15db42ebe4bc191649d4135cbbee7e58eefd96c2ed1c3fad03c4e

See more details on using hashes here.

Release history Release notifications | RSS feed

4.3.0

2 files

4.2.0

2 files

4.1.0

2 files

This release

4.0.2 This release

2 files

4.0.1

2 files

4.0.0

2 files

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