Overview
The TestDriver agent is an expert test-creator that runs inside your AI client (Claude Code, Cursor, VS Code, and others). It writes, runs, and debugs real end-to-end tests by driving your app the same way a person would β using AI vision to find elements, click, type, and assert β through the TestDriver MCP Server. Unlike a chat assistant that only suggests code, the agent works iteratively against a live sandbox: it starts a session, performs each action, writes the generated code to your test file, verifies the result with a screenshot, and reruns the test until it passes.What it does
- Builds tests from scratch using TestDriver skills and best practices.
- Drives a live sandbox via MCP tools (
session_start,find,click,type,assert,check, β¦), getting a screenshot and generated code after every action. - Writes code immediately to the test file after each successful step β never all at once at the end.
- Verifies visually with
checkto confirm each action did what was intended. - Runs the test itself with
vitest runand iterates until it passes reliably. - Shares the run report β after each run it surfaces the
TESTDRIVER_RUN_URLso you can watch the recording.
Installation
The agent is installed automatically bytestdriverai init, alongside the skills and the MCP server:
| Client | Agent location |
|---|---|
| Claude Code | .claude/agents/testdriver.md |
| VS Code (Copilot) | .github/agents/testdriver.agent.md |
| Cursor | .cursor/rules/testdriver.mdc |
| Windsurf | .windsurf/rules/testdriver.md |
| Codex | AGENTS.md |
| Zed | .rules |
Prerequisites
You need a TestDriver API key. Create one at console.testdriver.ai/team andinit will save it to .env as TD_API_KEY.
Using the agent
Once installed, invoke it from your clientβs chat:tests/, and run it for you.
Related
- Skills β the building blocks the agent composes tests from
- MCP Server β the tools the agent uses to drive your app
- Generating tests β how test generation works end-to-end

