testsprite-cli README

项目的 README,来自 github.com/TestSprite/testsprite-cli。合并为一个 markdown 文件:README.md。

TestSprite

The verification layer for the agentic coding era.

AI ships code in minutes — verifying it hasn't. testsprite opens your live app, uses it like a real user, and shows your coding agent exactly what broke — so it fixes its own work before a bug ever reaches you.

Proof, in public: verification beats model size. With this CLI in the loop, the cheapest model in the field shipped the most correct app on an open leaderboard — 89%, at half the cost of the priciest one. See the leaderboard →

npm version npm downloads Node 20.19+, 22.13+, or 24+ License Apache 2.0 CI

Website Docs Follow on X LinkedIn Join our Discord

⭐ Help us reach more developers and grow the TestSprite community. Star this repo!

▶ Watch the launch video — the three hard limits every coding agent hits, and the loop that breaks them (4 min).


What is it?

TestSprite is the AI testing platform 100,000+ teams use to test their software, frontend and backend — in the cloud, against the live product, not mocks. This repo is its official CLI.

It puts that platform in your coding agent's hands: the agent verifies every behavior it ships, and what broke comes back as one result — the failed step, its cause and a fix — it can act on, with no dashboard scraping. Humans drive the same surface from a terminal or CI.

⭐️ Star the Repository

testsprite-repo-star-fast

If you find testsprite useful, a GitHub Star ⭐️ would be greatly appreciated — it helps other builders (and their agents) find the project, and stars notify you about new releases.

Quickstart

You need Node.js 20.19+ on the 20.x line, 22.13+ on 22.x, or 24 or later. Using 0.16? Read its command reference.

From your app's repository, install the CLI and run setup. It prompts for your workspace API key and installs the skills for the coding agents it detects.

npm install -g @testsprite/testsprite-cli
testsprite --version
testsprite setup
testsprite auth status

Choose your project and target. Run testsprite project list to find an existing project. For a new frontend project, create it and add the URL where your app is running. Replace the URL below with yours and set PROJECT_ID to the ID printed by project create.

testsprite project create --type frontend --name "Checkout"
PROJECT_ID=your-project-id
testsprite project env create "$PROJECT_ID" --name staging --url https://staging.example.com

Get your first test. Ask the project's agent to propose coverage. If it asks a question in a text message, answer with testsprite reply "your answer". For a question card, submit all the numbered answers together with testsprite apply --answer 1=b --answer 2=a,c. Review the proposed steps in the terminal and apply the plan when they match what you want to verify. For a backend project, attach the API specification with --file ./openapi.yaml.

testsprite plan "Verify that a guest can place an order with a test card" --project "$PROJECT_ID" --steps
testsprite apply
testsprite test list --project "$PROJECT_ID"

Run and inspect. A project run waits for the suite when you pass --wait. Exit 0 means it passed. On exit 1, look for a failed or blocked row in results[] and copy its resultId to inspect the error and available evidence. If no row failed, check runFailures for an execution-level error such as cancellation. Without --output json, each run also prints a Dashboard: link that opens it in the Portal.

testsprite run --project "$PROJECT_ID" --wait --output json
RESULT_ID=your-result-id
testsprite result get "$RESULT_ID" --out ".testsprite/results/$RESULT_ID"

After deploying a fix, run the affected test again with testsprite run "$TEST_ID" --wait, using its ID from test list. To resume waiting for a run you already started, use its run ID with testsprite run wait "$RUN_ID". The scripting example shows how to extract both IDs and preserve the verdict in CI.

Testing an environment on your machine

Start your frontend app on port 3000 and save it as the project's environment. A run on that environment opens a tunnel from this machine and waits for the cloud runner.

testsprite project env create "$PROJECT_ID" --name local --url http://localhost:3000
testsprite run --project "$PROJECT_ID" --env local

The project's agent explores the app through the same kind of tunnel: ask it with testsprite plan, and when it asks for a tunnel, run testsprite tunnel start in another terminal and testsprite reply "The tunnel is running.". Review and apply the test plan, then run with --env local. An ordinary Ctrl-C detaches a public run. With a tunnel this command opened, Ctrl-C cancels unfinished work by default and closes the tunnel. Local frontend testing and tunnels

Commands

Task Command
Check credentials or install coding-agent skills auth status, setup, agent status
Manage a project and its targets project list, project create, project env
Propose tests, review them and save them plan, status, reply, reject, apply
Find the ID or steps of a saved test test list --project <id>, test get <test-id>
Launch a project, named tests or a saved list run --project <id>, run <test-id...>, run --testlist <list-id>
Follow or cancel an execution run wait <run-id...>, run cancel <run-id...>
Read results and download evidence result list --run <run-id>, result list --test <test-id>, result get <result-id>
Automate scheduled tests or a pull-request gate schedule, ci init github, ci run

For test lists, tunnel management, usage, diagnostics, profiles and exit codes, see the command reference. To migrate shell scripts or previously installed agent skills from 0.16, see Upgrading from 0.16.

Why a CLI for coding agents?

How it works

Every time your agent changes code, it asks one question: is this behavior already covered by the suite?

Every pass is banked into a durable suite, so coverage compounds as the project grows — a lasting record of every requirement it has ever gotten right, far bigger than any context window.

flowchart TD
    A["🤖 Your coding agent<br/>Claude Code · Codex · Antigravity · Kimi · Cursor · Trae …"]
    D{"behavior already<br/>covered by the suite?"}
    B["<b>testsprite plan → apply</b><br/>the project's agent writes a test<br/>for the new behavior"]
    R["<b>testsprite run --project &lt;project-id&gt; --wait</b><br/>run the existing tests"]
    C{{"☁️ TestSprite testing agent<br/>runs the test like a real user against<br/>real browsers & real APIs on Cloud"}}
    F["<b>testsprite result get</b><br/>one test's result in the run:<br/>failed step · screenshots · video ·<br/>cause · fix"]
    S[("📚 Durable integration suite<br/>grows with every pass")]

    A -->|"writes / changes code"| D
    D -->|"no — new behavior"| B
    D -->|"yes"| R
    B --> R
    R --> C
    C -->|"pass ✅"| S
    C -->|"fail ❌"| F
    F -->|"agent reads the result<br/>& fixes the code"| A
    S -.->|"defines what's covered"| D

The cloud is a black box on purpose: your agent describes intent and reads results. It never has to know how the test was driven — only what a real user experienced.

Proved in public

On CoderCup — an open leaderboard where frontier coding agents build the same app under the same rules, with TestSprite as the referee — the cheapest model in the field shipped the most correct app on the board: 89%, at half the cost of the priciest one.

That's the point of all of this: you no longer need the biggest, most expensive model to ship software you can trust — top-tier quality, without paying top-tier prices, within reach of every team.

Getting help

Contributing

Contributions are welcome — the CLI is plain TypeScript/Node (20.19+, 22.13+, or 24+), tested with Vitest, built with tsc. Getting a dev loop running takes a minute:

git clone https://github.com/TestSprite/testsprite-cli.git
cd testsprite-cli && npm install
npm run build       # tsc → dist/ ; try it: node dist/index.js --help
npm test            # unit suite — no network or credentials needed
npm run lint:fix    # ESLint
npm run typecheck   # tsc --noEmit

Pull requests target the main branch. The full guide — build from source, test tiers, CI checks, branches, project layout — is in CONTRIBUTING.md.

Support — if you need any help, we're responsive on Discord, and feel free to email us at [email protected] too.

License

Apache-2.0 © TestSprite

testsprite-cli (TestSprite/testsprite-cli)

正在搜索数据库…

这是什么?TestSprite 的官方命令行工具。TestSprite 是一个 AI 测试平台,已有超过 10 万个团队用它对前端和后端进行云端测试,测试对象是真实运行的产品而不是模拟数据 —— 发现问题后还会反馈给你的编程智能体,让它自己修复自己写的代码。
那这到底是云服务,还是跑在我电脑上的工具?两者都是:它是一个终端命令行工具,但测试在 TestSprite 云端执行,针对的是你真实运行的应用。同一套命令既可以由编程智能体调用,也可以由人在终端手动操作,还能接入 CI。
我怎么把它跑起来?需要 Node.js 20.19+、22.13+ 或 24+。运行 'testsprite setup'(或者不全局安装直接用 'npx @testsprite/testsprite-cli'):一条命令会让你输入 API key,验证有效性,然后把验证循环技能装进你的编程智能体。
它能接入哪些编程智能体?支持八个目标:claude、cursor、cline、windsurf、antigravity、kiro、copilot、codex。安装时会自动检测你在用哪些,并给它们装上对应技能;随时可以运行 'testsprite agent status' 查看结果。
在依赖它之前,有什么坑我需要提前知道?必须使用 TLS —— 命令行工具绝不会退回到明文传输,所以在会重新签名 TLS 的网络里,你需要把 NODE_EXTRA_CA_CERTS 指向你所在组织的根证书。免费版的门户运行在没有设置公开的项目 URL 之前也会一直被阻止。
只有用 AI 智能体写代码的人才用得上它吗?不是 —— 智能体循环是主打玩法,但人也可以在终端或 CI 里直接用同一套命令,它还提供了非交互式参数,方便在 CI 和初始化脚本里使用。
我用它的时候,有什么东西会离开我的电脑?测试流量通过 TestSprite 的 TLS 加密云隧道传输。唯一一次例行联网是最多每 24 小时一次的 npm 仓库版本查询,只发送包名,绝不会发送你的 key 或数据;可以通过环境变量把它关掉。
测试失败时,我的智能体能拿到什么信息?通过 'testsprite test failure get' 会得到一个自成一体的最新失败结果包 —— 包含判定结论,以及每一步的状态、截图和 DOM 定位 —— 设计目的就是让智能体能直接据此行动。'test failure summary' 会给出一屏大小的分诊卡片,'test diff' 则可以对比两次运行,包括每一步状态的翻转情况。
TestSprite 能帮我提出测试方案,而不是让我自己写吗?可以。'testsprite test plan generate --project' 会探索你的应用(或读取上传的 API 规范),起草测试用例,并暂存起来供你审阅,不会动你磁盘上的任何东西 —— 你留下想要的,去掉不要的。每个实际运行的阶段都会消耗积分;上传 PRD 会因嵌入处理计费 0.5 积分,而 API 规范是免费的。
我必须在线编写测试计划吗?不用。'test scaffold' 可以生成一份符合 schema 的起始测试计划,'test lint' 可以完全离线校验计划文件 —— 不联网、不需要凭据 —— 还能用 --dry-run 预览将要执行的命令。本地项目可以完全跳过探索步骤,直接通过 'test create --plan-from' 按照编写好的计划运行。
我怎么确认一切都配置正确?'testsprite doctor' 会做一次完整的环境诊断 —— 包括 CLI 和 Node 版本、配置档案、端点、凭据、网络连通性和智能体技能 —— 失败时会以非零状态码退出。'testsprite agent status' 则可以查看哪些编程智能体已经装上了验证技能。
大小
2.4 MB
星标
5.2K
时长
5个月
提交 · 90 天